Home forums Using CanvasJS New Datapoints do not get connected in the graph

This topic contains 2 replies, has 2 voices, and was last updated by  Jelch 4 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11536

    Jelch
    Member

    Hi,
    I’m trying to add new datapoints to my graph.
    The graph should contain progress on 2 excercises and the weight used (only in german) on every training

    They will show up in the legend, but will not connected in the graph.
    http://jsfiddle.net/QwZuf/432/
    I hope you can see it at jsfiddle, the graph was meant to take a standalone html page (so its quite big)
    After several attempts I finally got the buttons and adding of datapoints running but they won’t show up ?

    • This topic was modified 4 months, 2 weeks ago by  Jelch.
    #11540

    Sanjoy
    Moderator

    Jelch,

    Here y values are string. So, by parsing newly assigned y values to number will render the updated chart. Change the click handler function as below-

    $("#AddDate").click(function () {
            dataPointsK.push({ x:TrainingNr ,y: Number(document.getElementById("deadlift").value)});
            dataPointsB.push({ x: TrainingNr,y: Number(document.getElementById("benchpress").value)});
            TrainingNr = TrainingNr +1 
    	chart.render();
    
    	});
    #11573

    Jelch
    Member

    wow
    thank you so much !
    now it works.
    Now i only have to find a way to store the datapoints in a file (tsv or something).
    But that has much lower priority.

    Thank you so much again !

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

You must be logged in to reply to this topic.