Home Forums Chart Support display legent without data

display legent without data

Viewing 7 posts - 1 through 7 (of 7 total)
  • #20494

    Hello,

    how can I display all legend text even if dataPoints: [] is empty?

    (I want user to see the serieses that going to be display even if data not arrived yet).

    Thanks,
    Larry

    #20496

    Larry,

    You can add an empty object to dataPoints to show legend and remove the empty object when you update dataPoints. Please take a look at this jsfiddle.


    Vishwas R
    Team CanvasJS

    #20499

    Vishwas,

    thanks for your reply, I have 2 questions about it:
    1. is it different from just add empty objects as default to each dataPoint? also no need to delete it
    2. as you can see in your solution, Xaxis is changed due to this solution. why its happens?

    #20500

    Larry,

    1. is it different from just add empty objects as default to each dataPoint? also no need to delete it

    Both are same. However empty object in a dataSeries can affect axis-range.

    2. as you can see in your solution, Xaxis is changed due to this solution. why its happens?

    That’s because of empty object. To avoid this you can add a dataPoint with y-value set to null. Please take a look at this updated jsfiddle.


    Vishwas R
    Team CanvasJS

    #20501

    Vishwas,

    this is better solution for me, but I still have problem:

    Xaxis is Date , I dont know what will be the Date I receive (its realTimeChart, Date can be random),
    so lets say I set the dummy data to ‘April 30, 2018’ for ‘series1’ but ‘series2’ getting data with xValue: ‘April 30, 2022’.

    it will cause an empty gap betwen ‘April 30, 2018’ – ‘April 30, 2022’

    Thanks,
    Larry

    #20550

    Hi,

    do you have solution for this problem?
    please tell me if my example not clear enough

    Thanks,
    Larry

    #20577

    Larry,

    You can set the dataPoint value to first dataPoint x-value of any other dataSeries. Please take a look at this updated jsfiddle.


    Vishwas R
    Team CanvasJS

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.