Line chart X-axis last label is not displayed

303 views
Skip to first unread message

Indrayani Dixit

unread,
May 2, 2012, 12:56:53 PM5/2/12
to google-visua...@googlegroups.com

I am using the google api line chart to display 4 data points. Since both x and y axes use the number format, the graph generated is continuous and I cannot specify the exact co-ordinates to display for both axes. Now, when I specify the datapoint [5,31], I expect to see the value 5 displayed somewhere on the x-axis, but its not. Please let me know if anyone has any solution for this.

Please see the code below to create a graph :

google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
     var data = google.visualization.arrayToDataTable([
        ['Year', 'Baseline Percentage'],
        [0, 100],
        [1, 79],
        [2,  63],
        [5,  31]
     ]);

    var chart = new     
google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, {curveType: "function",
                          width: 500, height: 400, hAxis :{showTextEvery :1},
                      vAxis: {maxValue: 10}, interpolateNulls: true});

}​

asgallant

unread,
May 2, 2012, 2:34:21 PM5/2/12
to google-visua...@googlegroups.com
There is no way to force a continuous axis to display any particular value.
Reply all
Reply to author
Forward
0 new messages