Home Forums Feature Requests & Feedback stripLines add a showInLegend option

stripLines add a showInLegend option

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

    Hello,

    I can successfully and quite easily add stripLines to my chart, great.
    I set for example 3 of them, with a startValue and endValue.

    They are the of the same nature and I would really like the option to get a legend for them (instead of repeated labels); why not with an optional option like ‘showinlegend’.

    what do you think? Thanks

    #29470

    @xavcactus,

    Legends are basically used to represent dataSeries in the chart. To give some identification to stripLines, you can use labels property.

    Can you kindly share your exact scenario and requirement, so that we can suggest an optimal solution?

    —-
    Manoj Mohan
    Team CanvasJS

    #29483

    Hi @manoj-mohan, thanks for your answer.

    I saw the stripLines label parameters but I would really like to be able to add them to the legend.
    I can have several stripleLine in the graph and would not like the label to repeat itself N times.

    check the image attached to get an idea of what I’m trying to reproduce: example
    Those greys stripline are periodic throughout…time and there could be more in display. Maybe it’s not a “indutry-standard”, but it would make sense to gather it in the legend ?

    • What do you think? would this be something you could include to the library?
    • If not, as a quick fix, I played around quickly to get into the legend but I failed, each time I render (chart or legend) it delete my array chart.legend.rows[0].items.push({markerType: "circle", markercolor:"grey", text: "tide"})is there no way to hack a the legend

    Thanks!

    PS.: it would be nice to have a preview-post or edit-post option available here

    #29532

    @xavcactus,

    Legend for a stripline is not possible as of now. As mentioned earlier, legends are used to represent dataSeries.

    Based on the solution that you have shared, you need to update the legend items once the chart is re-rendered.

    —-
    Manoj Mohan
    Team CanvasJS

    #29568

    @manoj-mohan
    Do you have an example of updating/hacking the legend please?

    For what I gather, the ‘Legend’ ‘setLayout’ is called each time the chart is rendered (so the windows resized) and parses it’s ‘dataSeries’ each time thus making useless altering it’s items or rows items.

    #29582

    Well, I found a way around :) !
    (another way around, I start to have lot’s of ways around to do some simple things !)

    Check https://jsfiddle.net/mgck92pw/
    – You’ll need to use another axis and hide it here “axisX2”.
    – You’ll also need another ‘data’ item, with just one value. I’ve chosen here “rangeArea” to get a square element in my legend.

    IF you could show me a way to interact with the legend in another way, that’ll be great! thanks

    #29629

    @xavcactus,

    Glad that you have figured it out. Thanks for sharing the solution it will be helpful to others.

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.