如何在注释谷歌图表中将图例值设置为当前日期值

时间:2016-04-04 09:13:34

标签: php google-visualization

我只想将当前日期值设置为图例默认值(即今天日期是25/1/2015,然后它将选择默认图例值为9.我找不到配置,使其成为当前日期的默认值。我正在使用谷歌注释图表

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', 'WTI');
    data.addColumn('number', 'Nat Gas FOB US');

    data.addRows([
      [new Date(2015, 0, 1), 5],
      [new Date(2015, 0, 4), 1],
      [new Date(2015, 0, 7), 3],
      [new Date(2015, 0, 10), 5],
      [new Date(2015, 0, 13), 3],
      [new Date(2015, 0, 16), 7],
      [new Date(2015, 0, 19), 3],
      [new Date(2015, 0, 22), 4],
      [new Date(2015, 0, 25), 9],
      [new Date(2015, 0, 28), 8],
      [new Date(2015, 0, 31), 6]
    ]);
    data.addRows(usdeurl);


    var firstday = new Date(new Date().getFullYear(), 0, 1);
    var lastday = new Date(new Date().getFullYear(), 11, 31);
    var options = {
        displayAnnotations: true,
        zoomStartTime: firstday,
        zoomEndTime: lastday,
        highlightDot: 

    };

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

0 个答案:

没有答案