Home forums Using CanvasJS can we get series minimum and maximum value of datapoints

This topic contains 11 replies, has 5 voices, and was last updated by  Vishwas R 1 month, 3 weeks ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #19666

    aksangwan
    Member

    can we get series minimum and maximum value of datapoints in case of multiseries line chart

    • This topic was modified 10 months ago by  aksangwan.
    • This topic was modified 10 months ago by  aksangwan.
    #19678

    Indranil Deo
    Member

    @aksangwan,

    It is not possible to get the minimum and maximum y value in a series directly as of now. However, with few lines of code, you can achieve this. Please take a look at this jsfiddle.

    ___________
    Indranil Deo,
    Team CanvasJS

    #22594

    jmnn
    Member

    Hi
    is possible to draw max and min in chart with a stripline or similar?

    • This reply was modified 3 months ago by  jmnn.
    #22598

    Priyanka M S
    Member

    @jmnn,

    Please take a look at this jsfiddle.

    __
    Priyanka M S
    Team CanvasJS

    #22609

    jmnn
    Member

    Thank you very much. It is ok. Congratulions!
    Last question. is possible to draw this chart but dinamics data? Similar at striplines but pointing specifically to the datapoint (max and min)
    Thanks for your help.

    #22623

    Priyanka M S
    Member

    @jmnn,

    Yes, the same logic should work fine to add stripLines at the minimum and maximum dataPoints of a dynamically updating chart.

    __
    Priyanka M S
    Team CanvasJS

    #22628

    jmnn
    Member

    I’m sorry, the link was not shown in the previous message. I’ll write it again.

    Thank you very much. It is ok. Congratulions!
    Last question. is possible to draw this chart but dinamics data? Link: https://canvasjs.com/html5-javascript-line-chart/ (see picture in archive http://prntscr.com/kv9sp9 ) Similar at striplines but pointing specifically to the datapoint (max and min). I understand that if know the datapoints, i can to indicate manually
    { y: 520, indexLabel: “highest”,markerColor: “red”, markerType: “triangle” },
    { y: 410 , indexLabel: “lowest”,markerColor: “DarkSlateGrey”, markerType: “cross” },
    but i can not to draw the highest and lowest point when the data are dinamics. I can to draw the stripline with max and min but only points no.
    nullThanks for your help.

    #22630

    Priyanka M S
    Member

    @jmnn,

    You can calculate the minimum and maximum of dataPoints y-values after updating it dynamically and assign the desired markerType and stripLines to the lowest and highest dataPoint y-values as shown in this jsfiddle.

    __
    Priyanka M S
    Team CanvasJS

    #23109

    jmnn
    Member

    Thank you very much for your help. It was good for my job. I have it 99% completed. I just need the last step. I update the last point well but the crosshair does not update. I have used the length-1 option but the value of x is time and always has the value of the first point before updating. How could I update the crosshair?
    I also thought about erasing the last datapoint and adding the new one, but I did not find the instructions to erase a datapoint. Can you give some solution?
    Thanks for your help

    Look Picture picture picture

    #23110

    Vishwas R
    Keymaster

    @jmnn,

    How could I update the crosshair?

    It would be helpful for us to understand your scenario better when we look at working code live in JSFiddle than guessing the issue by looking at screenshot. I request you to create JSFiddle reproducing the issue and share it with us.

    I also thought about erasing the last datapoint and adding the new one, but I did not find the instructions to erase a datapoint. Can you give some solution?

    Datapoints is an array. So you can remove last dataPoint using either pop method or splice method.


    Vishwas R
    Team CanvasJS

    #23119

    jmnn
    Member

    Hi
    Thanks for your help

    I send you the code. The last price changes every 5 seconds, but only the price changes, the time is always the same, it does not change. (see crosshair)
    The file structure is as follows:
    1.- Data Historic Data ( 5 Datapoints)
    2.- Actual Data (update1(chart)
    3.- Update data (update2(chart)
    This is an example.
    The problem is in update2(chart). I have used the option (chart.options.data [0] .dataPoints [length-1] .y = price;)
    to place the data in the right place but it does not serve to update the value of time and I have not found the solution for it for updating date/time

    Code : jsfiddle.net

    thanks for your help

    • This reply was modified 1 month, 4 weeks ago by  jmnn.
    #23137

    Vishwas R
    Keymaster

    @jmnn,

    In update method, you are updating the last dataPoint’s y-value only and not x-value because of which x-value remains same and being shown in crosshair as such. Updating x and y-values should work fine in your case. To keep axis labels constant, please take a look at this sample dashboard. You can download the dashboards sample from our download page and try customizing and running locally.


    Vishwas R
    Team CanvasJS

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

You must be logged in to reply to this topic.