Results 1 to 3 of 3

Thread: Terminating / Stopping a Line Chart

  1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    5
    Answers
    1

    Default Answered: Terminating / Stopping a Line Chart

    I'm looking to have two individual line series on one chart. One series will have complete data while the other will be display partial data.

    I've tried stopping the partial series with null / undefined / blank string values with no luck. I'm noticing that the path of the stroke is as if the chart is still an area chart-- it colors the entire outline of the fill (even if there is no fill) and will always try to close the stroke path.

    Using 'null' / and empt datapoints:

    ChartTest.png

    Using 'undefined' datapoints:

    ChartTest2.png

    Basically, I would like to just have a single line that stops rendering if there's no y-axis data. There seems to be more discussion of this for Ext.JS but I've yet to see an answer for ST 2.1.

    Seems like this should be an easy fix but I can't find a solution! Any suggestions?

    Code:
    var config = {
     store: {
                  fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
                  data: [
                      {'name':'metric one', 'data1':7, 'data2':12, 'data3':14, 'data4':8, 'data5':13},
                      {'name':'metric two', 'data1':5, 'data2':8, 'data3':16, 'data4':10, 'data5':3},
                      {'name':'metric three', 'data1':10, 'data2':2, 'data3':14, 'data4':12, 'data5':7},
                      {'name':'metric four', 'data1':'', 'data2':14, 'data3':6, 'data4':1, 'data5':23},
                      {'name':'metric five', 'data1':'', 'data2':38, 'data3':36, 'data4':13, 'data5':33}
                  ]
                },
                axes: [{
                    type: 'numeric',
                    position: 'left',
                    fields: ['data1'],
                    maximum: 20,
                    title: {
                        text: 'Sample Values',
                        fontSize: 15
                    },
                    grid: true,
                    minimum: 0
                }, {
                    type: 'category',
                    position: 'bottom',
                    fields: ['name'],
                    title: {
                        text: 'Sample Values',
                        fontSize: 15
                    }
                }],
                series: [{
                    type: 'line',
                    highlight: {
                        size: 7,
                        radius: 7
                    },
                    style: {
                        stroke: 'red',
                        lineWidth: 10,
                        dataClose: true
                    },
                    xField: 'name',
                    yField: 'data1',
                    marker: {
                        type: 'path',
                        stroke: 'blue',
                        lineWidth: 0
                    }
                }]
            };
    Last edited by rolska; 10 Dec 2012 at 8:27 PM. Reason: Added second image of chart when using "undefined" data points.

  2. The chart only currently supports a full line, it cannot have breaks in it.

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,379
    Answers
    3997

    Default

    The chart only currently supports a full line, it cannot have breaks in it.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  4. #3
    Sencha Premium Member
    Join Date
    Jan 2013
    Posts
    14
    Answers
    1

    Default Too bad

    This sort of behavior is necessary if you want people to be able to mix series types. The bar series adds a gap between the vertical axes and the first and final data points. In a chart where you just have a line series, this works because their first and final points are on the axes but with that gap added from the bar chart, the first and final strokes down to the x axis are visible.

    I think the source code documentation might be out of date too because the code below is in the Line series source code documentation and it suggests that false values would cause a break in the line.


    Code:
    if (yValue === false) {                
      if (path.length == 1) {                    
        path = [];                }                
      onbreak = true;                
      me.items.push(false);                
      continue;            }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •