google / google-visualization-issues

288 stars 35 forks source link

AnnotationChart scaleColums doesn't display 3rd scale in the middle #2858

Open robertoschwald opened 4 years ago

robertoschwald commented 4 years ago

API doc says: "If you specify three values, a scale for the third series will be added to the middle of the chart." See https://developers.google.com/chart/interactive/docs/gallery/annotationchart

But that seems not to work. 3rd scale is displayed on the right y axis instead, which overlaps the 2nd one. Example code:

google.charts.load('current', {'packages':['annotationchart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('date', 'Date');
        data.addColumn('number', 'Level');
        data.addColumn('number', 'Flow');
        data.addColumn('number', 'Temperature');
        data.addRows([
            [new Date(2020, 9, 15, 11, 0, 0, 0), 20, 10645, 10.5],
            [new Date(2020, 9, 15, 12, 0, 0, 0), 21, 12374, 11.5],
            [new Date(2020, 9, 15, 13, 0, 0, 0), 22, 15766, 12.5],
            [new Date(2020, 9, 15, 14, 0, 0, 0), 25, 34334, 13.5],
            [new Date(2020, 9, 15, 15, 0, 0, 0), 17, 66467, 11.5],
            [new Date(2020, 9, 15, 16, 0, 0, 0), 18, 79463, 10.5]
        ]);

        var chart = new google.visualization.AnnotationChart(document.getElementById('chart_div'));

        var options = {
          displayAnnotations: true,
          colors: ["green", "red", "blue"],
          scaleColumns: [0,1,2],
        };

        chart.draw(data, options);
}

annotation_chart_3rd_scale_bug

dlaliberte commented 4 years ago

This is one feature that the old AnnotatedTimeline used to support which we have not yet implemented in the AnnotationChart. I'm not sure if or when we will get around to it, so the documentation should be updated at least.