Home forums Using CanvasJS Just the last Value from an cvs

This topic contains 9 replies, has 2 voices, and was last updated by  James 1 year, 5 months ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
  • #18615


    I have a cvs file with this content in one row:

    1/5/2018 17:00 55 72.1 8.36 5.6 54.6 0 0 On Off Off Off Off Off Off

    All charts are working perfect!

    But now I need only the last row from this csv.
    I would like to label each column with a final result like this:

    Date: 1/5/2018
    CCond (S11): 556
    Temp (S12): 72.1
    pH (S21): 8.36
    Retrans (A11): 5.6
    and so on

    Is there a way to do this?

    Thanks for any help

    • This topic was modified 1 year, 5 months ago by  James.


    Can you please explain more about your requirements, so that we can help you out better. Also, it would be great if you could:

    1. Elaborate what you mean by

    I would like to label each column with a final result like this:

    2. Provide us some pictorial representation of the chart you are looking for.

    3. Explain what all the columns in your CSV file represent.

    4. Mention the values to be represented on axis X and axis Y.

    5. Provide us some sample data points.

    Suyash Singh
    Team CanvasJS



    My file looks like this:

    Date Sensor (S11) Sensor Temperature (S12) Sensor (S21) FlowMeter Total (D2) Output (A1) Output (A2) CCond Temp pH Flowmeter Retrans Prop
    µS/cm °F gal % % % %
    11/16/2017 00:10:00 880 69.7 8.32 0 8.8 65.8 4 12
    11/16/2017 00:20:00 881 69.7 8.31 0 8.8 65.8 4 12
    11/16/2017 00:30:00 882 69.6 8.32 0 8.8 65.9 4 12
    11/16/2017 00:40:00 884 69.5 8.32 0 8.8 66 4 12
    11/16/2017 01:40:00 885 69.2 8.32 0 8.8 66.2 4 12

    Link to a sample CSV:

    I have a line chart for this which works perfect!

    For some kind of Dashboard, I would need only the LAST row from this file

    with all titles like “Date” “sensor (S11)” and left (Y-Axis) and only the values from the last row on the X-Axis.
    Like this:

    Date: 11/16/2017 00:10:00
    Sensor(S11): 880
    Sensor Temperature (S12): 69,9
    and so on

    I hope this helps



    Are you looking for something like this? If not, please provide a representation of your requirement.
    Suyash Singh
    Team CanvasJS


    Hi Suyash,

    Thank you for all your effort!

    It is much simpler as you think. I have made a small picture how it can look:

    I can do some styling afterward with all your tools and options.
    The most important thing is to have only the last row of data. Because I need a lot of this “widgets” in a Dashboard.
    Hope this helps to understand my needs.



    Please take a look at this jsfiddle.

    Suyash Singh
    Team CanvasJS


    That’s absolutely perfect, exactly what I need.
    Thanks a lot!


    One problem, everything works fine as long as I use your CSV file. If I change this to one of my files I receive following error:
    Error Message

    here is my: CSV

    The difference that I see is a “carriage return” in my file after each row. I cannot change this as the CSV is generated.

    Thanks for any help!



    Since your new CSV has a blank line in the end, you will either have to delete the blank line in your CSV or change the code accordingly as in this jsfiddle.

    Suyash Singh
    Team CanvasJS


    Hi Suyash,
    Thank you for the great help. I would never have this realized.

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

You must be logged in to reply to this topic.