Home forums Report Bugs line chart: new line not visible on pushing dataseries

Tagged: 

This topic contains 5 replies, has 2 voices, and was last updated by  Priyanka M S 4 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #20960

    akshay30498
    Member

    I am trying to add new dataSeries using this:
    var newseries={
    type:”line”,
    dataPoints:[
    {y:frustrated[0],x:’1′,indexLabel:'{y}%’},
    {y:frustrated[1],x:’2′, indexLabel:'{y}%’},
    {y:frustrated[2],x:’3′, indexLabel:'{y}%’}]
    }
    chart.options.data.push(newseries);
    chart.render();
    here frustrated array contains three float values which i got from ajax response.
    Problem is that the data is being pushed into the data array but i can only see tooltips corresponding to the new line, not the line….

    I’ve tried changing it to a column chart… again on adding new data columns get shifted and all but the new columns are not visible.

    #20964

    Priyanka M S
    Member

    @akshay30498,

    It seems like you are passing invalid x-values to chart. Passing valid number to x-value of dataPoint should work fine in your case.
    If this doesn’t solve your requirement, please share a jsfiddle so that we can understand your requirement better and help you out.

    __
    Priyanka M S
    Team CanvasJS

    #20983

    akshay30498
    Member

    I have used this:
    axisX:{
    valueFormatString: ‘Test #’,
    interval:1,
    maximum:3.5
    }
    So as far as x values are concerned they are fine…. because it is showing the chart with Test 1 Test 2 and Test 3 on X-axis
    its only so that assigning a new variable to datapoints doesn’t show the line… like i said tooltips are visible.

    PS: I am using https://cdnjs.cloudflare.com/ajax/libs/canvasjs/1.7.0/canvasjs.min.js

    • This reply was modified 4 months, 2 weeks ago by  akshay30498.
    #20988

    Priyanka M S
    Member

    @akshay30498,

    Can you kindly share a jsfiddle with sample data, so that we can look at your code, understand and help you out?
    We recommend you to use latest version of CanvasJS.

    __
    Priyanka M S
    Team CanvasJS

    #20990

    akshay30498
    Member

    hey!!!
    the “frustrated” array actually contained string “20”, “25” and “30”
    just thought about it while creating the fiddle
    So i used parseInt() around it and it showed line.
    What a noob mistake XD XD

    Anyways now it is working ^_^ yeye!!!
    thanx for the help tho :)

    Also about new version… why don’t u guys have a cdn for latest version? i don’t like downloading stuff … so i use cdn and latest cdn is for version 1.7.0 can u plz host the latest version on a cdn….

    #20995

    Priyanka M S
    Member

    @akshay30498,

    Glad that it’s working fine now.

    Instead of CDN, you can serve CanvasJS script from https://canvasjs.com/assets/script/canvasjs.min.js

    __
    Priyanka M S
    Team CanvasJS

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

You must be logged in to reply to this topic.