Home Forums Chart Support Problem in displaying Legend

Problem in displaying Legend

Viewing 6 posts - 1 through 6 (of 6 total)
  • #25701

    I have a working jsfiddle code below where the chart is rendering as expected but the problem is same legend(chart key) is showing different colors as repeating text which is not expected. My requirement is if the chart has same key(legend) that should fall under same color without repeating. Please help me to resolve this issue.

    jsfiddle
    Screenshot

    Regards,
    Samyukta

    #25739

    Samyukta,

    Legends are shown for each dataSeries with a marker and the text. In your case, it shows same name in multiple colors as you are passing same name to multiple dataSeries. Parsing JSON properly and passing legendText / name according to the dataSeries that you are creating dynamically should work fine. Please take a look at this JSFiddle for an example on multi-series chart from JSON file.


    Manoj Mohan
    Team CanvasJS

    #25760

    Thank you Manoj for your reply. But in my case, the data is coming as same name(legends in my case) for different months. I can’t change the data since it is coming from DB. Please have a look in these data and help me to resolve it.

    DB data

    Regards,
    Samyukta

    #25874

    Samyukta,

    Categorising dataseries based on the legendText (Short/Answer column in database) instead of doing it based on month number should work fine in this case. Please take a look at this JSFiddle which shows categorizing dataseries based on label from JSON.


    Manoj Mohan
    Team CanvasJS

    #25922

    Thanks for your response. But it’s client’s requirement to display legendText as ShortAnswer column NOT the month number. Can you please suggest how can I get this issue resolved?

    Regards,
    Samyukta

    #25939

    Samyukta,

    The sample provided by @manoj-mohan seems to work fine with your case. Please take a look at this updated JSFiddle.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.