juijs / jui-chart

SVG-based JUI chart that can be used in the browser and Node.js. Support many types of charts. (Dashboard, Map, Topology, Full 3D, Realtime)
https://codepen.io/collection/nLydod/
57 stars 25 forks source link

Automatically continuous line in line chart #69

Closed Orvisky closed 8 years ago

Orvisky commented 8 years ago

Is there any option to end line when value is undefined? Ex: when one line is shorter than second (when comparing year with plan)

Example:

data : [
            { date : new Date("2015/01/01 00:00:00"), sales : 50, profit : 35 },
            { date : new Date("2015/01/01 06:00:00"), sales : 20, profit : 30 },
            { date : new Date("2015/01/01 12:00:00"), sales : 0, profit : 5 },
            { date : new Date("2015/01/01 18:00:00"), sales : 0, profit : 25 },
            { date : new Date("2015/01/02 00:00:00"), sales : 0, profit : 20 }
        ]

Is there any solution for example to set as undefined and chart will dont error? (cant set as 0 because it will go down on axis)

data : [
            { date : new Date("2015/01/01 00:00:00"), sales : 50, profit : 35 },
            { date : new Date("2015/01/01 06:00:00"), sales : 20, profit : 30 },
            { date : new Date("2015/01/01 12:00:00"), sales: undefined, profit : 5 },
            { date : new Date("2015/01/01 18:00:00"), sales : undefined, profit : 25 },
            { date : new Date("2015/01/02 00:00:00"), sales : undefined, profit : 20 }
        ]

So the output effect will not be:

image

seogi1004 commented 8 years ago

I'll answer later review. Please wait.

Orvisky commented 8 years ago

Thx, i paste here you example from frontend (using chart.js).

image

My target is to allow this in your jui charts.

seogi1004 commented 8 years ago

I understand your requirements. I will add that feature to the Line Brush as soon as possible. Thank you good feedback.

Orvisky commented 8 years ago

Thank you very much.

seogi1004 commented 8 years ago

@Orvacko

There are many ways. But to know the data. When using two colors in one line, how does this data structure?

seogi1004 commented 8 years ago

Using the colors option, it may change the color of lines and areas. The second parameter in the callback function is a data index. Since the release before you check out the develop branch.

Below are sample links. http://chartplay.jui.io/?p=split_line_advanced http://chartplay.jui.io/?p=split_area_advanced

Orvisky commented 8 years ago

Thx for reply, but we have little miss understanding. I dont want to have many colors on same line. I have different 2 lines, but one line is shorter with data undefined. But yor code throws error on undefined.

colours: [
    '#f00000', '#0000FF', '#932693', '#18861A'
]

 data: [
      // actual year data, I HAVE only data to actual month, RED LINE, not equal size of data array throws error
     [1, 2, 3, 4, 5],
     // previous year data, I HAVE data for all previoues year, PURPLE LINE
     [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
    // this can bee green line, undefined throws error
   [undefined, undefined, undefined, undefined, undefined, 6, 7, 8, 9, 10, 11, 12],
    // this can be blue line
 [2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10]
]
seogi1004 commented 8 years ago

I understand. Please wait. We will resolve within a few days.

seogi1004 commented 8 years ago

@Orvacko Please check the sample below. https://github.com/juijs/jui-chart/blob/develop/sample/continuous_line.html

Orvisky commented 8 years ago

I think it has good structure and 'null' is good way. Good example.

Orvisky commented 8 years ago

I tryed it in your editor:

image

I think result is good. If you will merge it, it will also be in nodes.js package ?

seogi1004 commented 8 years ago

When the official release, node.js is also applied in the same way.

Orvisky commented 8 years ago

Thank you. Pls, do you know when you will do release? Because wee need it in our company project, so, i have to know some deployment date. Thank you :)

seogi1004 commented 8 years ago

Sorry for the late reply. It is expected to release in early May.