1. #1
    Sencha User
    Join Date
    Nov 2011
    Location
    Porto Alegre
    Posts
    6
    Vote Rating
    0
    rhiscar is on a distinguished road

      0  

    Default Unanswered: Create range reference chart

    Unanswered: Create range reference chart


    Hi everyone, I'm trying to build a range reference chart for a medical web app. But I'm having a hard time being able to add the range reference information. I want to create something close to this:
    5927426992_9f8a6c8bde_o.png
    I tried using series with Area chart but that didn't do the trick I also tried adding a rectangle on the render events, all three of them, still no luck. If anyone could bring some light to my issue I'll be more the glad.

    HTML Code:
    <html><head>    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">    <title>WW8</title>    <link rel="stylesheet" type="text/css" href="resources/css/ext-all.css" />    <link rel="stylesheet" type="text/css" href="examples/shared/example.css" />    <style>            .x-panel {            margin: 20px;        }        h1 {            font-size: 18px;            margin: 10px;        }        body {          padding: 30px;        }    </style>    <script type="text/javascript" src="bootstrap.js"></script>    <script type="text/javascript" src="grafico.js"></script></head>    <body id="docbody">        <h1>New WWHealth charts</h1>         <div style="margin: 10px;">            <a href="grafico.js">View Source</a>        </div>    </body></html>
    HTML Code:
    Ext.require(['Ext.data.*']);Ext.require('Ext.chart.*');Ext.require('Ext.layout.container.Fit');
    
    Ext.onReady(function() {    window.graphStore = Ext.create('Ext.data.JsonStore', {        fields: ['data1', 'maxRange', 'minRange', 'date'],        data: [{data1: 81, maxRange: 140, minRange: 90, date: '04/02/2011 00:02'},               {data1: 103, maxRange: 140, minRange: 90, date: '04/02/2011 12:02'},               {data1: 30, maxRange: 140, minRange: 90, date: '04/02/2011 13:02'},               {data1: 108, maxRange: 140, minRange: 90, date: '04/02/2011 15:02'},               {data1: 70, maxRange: 140, minRange: 90, date: '04/02/2011 17:02'}]    });    var square = Ext.create('Ext.draw.Component', {        viewBox: false,        items: [{            type: 'rect',            fill: '#79BB3F',            x: 0,            y: 0,            width: 100,            height: 100        }]    });
        this.handlePlot = function (t, opts) {        console.log(t);    };        var chartWW = Ext.create('Ext.chart.Chart',{            xtype: 'chart',            animate: false,            store: graphStore,            insetPadding: 30,            listeners: {                beforerender: this.handlePlot            },            axes: [{                type: 'Numeric',                minimum: 0,                maximum: 200,                grid: true,                position: 'left',                fields: ['data1'],                title: true,                grid: true,                label: {                    renderer: Ext.util.Format.numberRenderer('0,0'),                    font: '10px Arial'                }            }, {                type: 'Category',                position: 'bottom',                grid: true,                fields: ['date'],                title: false,                label: {                    font: '11px Arial',                    renderer: function(name) {                        return name.substr(0, 3) + ' 07';                    }                }            }],            series: [/*{                type: 'area',                highlight: true,                axis: 'left',                xField: 'name',                yField: ['minRange','maxRange'],                style: {                    opacity: 0.50                }            },*/{                type: 'line',                axis: 'left',                xField: 'date',                yField: 'data1',                listeners: {                  itemmouseup: function(item) {                      //Ext.example.msg('Item Selected', item.value[0] + ' visits on ' + item.value[3]);                  }                  },                tips: {                    trackMouse: true,                    width: 145,                    height: 40,                    renderer: function(storeItem, item) {                        this.setTitle('Data 1: ' + storeItem.get('data1') + '<br />date : '  + storeItem.get('date'));                    }                },                style: {                    fill: '#38B8BF',                    stroke: '#38B8BF',                    'stroke-width': 3                },                markerConfig: {                    type: 'circle',                    size: 4,                    radius: 4,                    'stroke-width': 0,                    fill: '#38B8BF',                    strokre: '#38B8BF'                }            }]        });        var mainPanel = Ext.create('widget.panel', {        width: 600,        height: 300,        title: 'Graphic',        renderTo: Ext.getBody(),        layout: 'fit',        items: [chartWW, square]    });});

    Thanks in advance for your help.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,677
    Answers
    3355
    Vote Rating
    749
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The line series is easy but to get the red/yellow/green I would actually use 3 more series and they are line series that are filled... this would have the added benefit that the code could handle different min/max values.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Location
    Porto Alegre
    Posts
    6
    Vote Rating
    0
    rhiscar is on a distinguished road

      0  

    Default


    Hi Mitchell, thanks for your quick answer. Well the solution you proposed almost solved my problem, the issue is I need to highlight a range of values. For instance using the picture on the thread from 1310 to 1260 is under value. I suppose I could create a line in the middle of those values thick enough to make it look like a range but that's not really what I'm looking for.

    I think that on my case I would have to create a new kind of series for my chart that could handle two values and behave almost like an area chart but on my case only highlighting between the values I've sent.

    Is there any other way of doing this?

    PS: Sorry for my bad English I'm from Brazil.

  4. #4
    Touch Premium Member
    Join Date
    Jan 2012
    Posts
    14
    Vote Rating
    0
    digitalwerker is on a distinguished road

      0  

    Default


    Have you found a solution for you problem? I am also looking for a range chart :/.

Thread Participants: 2

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar