Connect points in continuous line chart

95 views
Skip to first unread message

rvb

unread,
Jan 10, 2013, 9:06:35 AM1/10/13
to google-visua...@googlegroups.com
Hi,
I'm trying to make point (1) get connected with point (4). I've searched at API documentation, but without success. Is it possible? 


Thanks
<html>
<head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
        google.load('visualization', '1.0', {'packages':['corechart']});

        google.setOnLoadCallback(drawChart);

        function drawChart() {
            var data = new google.visualization.DataTable();
            data.addColumn('number', 'Year');
            data.addColumn('number', 'Sales');
            data.addRows([
                [1, 1000],
                [2, null],
                [3, null],
                [4, 1030],
                [5, 1080]
            ]);

            var options = { 'title'     : 'Line chart',
                'width'     : 400,
                'height'    : 300,
                lineWidth   : 2
            };

            var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
            chart.draw(data, options);

        }
    </script>
</head>

<body>
    <div id="chart_div"></div>
</body>

rvb

unread,
Jan 10, 2013, 9:31:45 AM1/10/13
to google-visua...@googlegroups.com
As usually happens, right after I write a thread, I find an answer.
If you have the same problem, is very simple to set your line chart to work this way. Just set interpolateNulls: true, in your chart options.

Thanks anyway. ;)
Reply all
Reply to author
Forward
0 new messages