Home forums Report Bugs problem with axis label when creating the chart with first element

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by  Sunil Urs 3 years, 6 months ago.

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

    izv
    Participant

    When I create dynamically a chart, the first axis label isn’t correct. But when I push the second and next points, it is correct.

    Here is the complete code:

    <!DOCTYPE html>

    <html lang=”en”>

    <head>

    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″/>

    <title>canvasJS</title>

    <script src=”canvasjs.js”></script>

    <script>

    window.onload=function(){

    var data = [];

    var serie = {type: ‘column’, name: ‘example’, showInLegend: true};

    var points = [];

    serie.dataPoints = points;

    data.push(serie);

    var chart = new CanvasJS.Chart(‘canvasjs’,{

    title:{

    text: ‘title’

    },

    data: data

    });

    chart.render();

    var bt1 = document.getElementById(“add1”);

    var bt2 = document.getElementById(“add2″);

    bt1.onclick=function(){

    var point = {label:”first”, y: 30};

    points.push(point);

    chart.render();

    }

    bt2.onclick=function(){

    var point = {label:”second”, y: 60};

    points.push(point);

    chart.render();

    }

    }

    </script>

    </head>

    <body>

    <div id=”canvasjs” style=”height: 300px; width: 100%;”></div>

    <div>

    <input type=”button” id=”add1″ value=”add first” />

    <input type=”button” id=”add2″ value=”add second” />

    </div>

    </body>

    </html>

    #4521

    Sunil Urs
    Keymaster

    izv,

    We were able to reproduce the issue. Will be fixing it at the earliest – in a day or two.

    #4610

    Sunil Urs
    Keymaster

    izv,

    Just wanted to inform you that the latest version contains a fix for this issue. Do update.

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

You must be logged in to reply to this topic.