Home forums Using CanvasJS can line chart – a coloured snake based on dataVariable

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Suyash Singh 4 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #14702

    sixD
    Member

    Hi Canvasjs,

    i need to know how to make each x-length of a line chart (not the whole line) change colour based on a value.
    So the output would look line a normal line chart (a single ‘snake’) but with gradation of colour along the snake based on a data variable

    example:
    – say i have data values: x, y and z
    – the x and y data makes a normal line chart, no problem.
    – the z data should control the COLOUR of the line for that little bit of the line.
    – so say z can go from -5 to +5 then this would be represented in the chart by colour going from, say, red to green
    – it would be shown only in that particular segment (i.e. for that X value until the next X value) of the same single x-y line

    is it possible to override a charts lineColour ‘locally’, like this?

    Cheers

    #14704

    Suyash Singh
    Moderator

    @sixd,

    Please check this jsfiddle.

    ___
    Suyash Singh
    Team CanvasJS

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

You must be logged in to reply to this topic.