2015-04-17 84 views
0

可以使用Google Charts(https://developers.google.com/chart/interactive/docs/points#rotations)旋轉折線圖點。也可以自定義各個點(https://developers.google.com/chart/interactive/docs/points#individual)。Google Charts - 動態旋轉線條點

我想根據傳遞給表的數據旋轉點。以下代碼加載自定義點,但不旋轉三角形。這甚至有可能嗎?

google.setOnLoadCallback(drawChart); 
    function drawChart() { 
    var data = google.visualization.arrayToDataTable 
     ([['X', 'Y', {'type': 'string', 'role': 'style'}], 
      [1, 3, null], 
      [2, 2.5, null], 
      [6, 3, 'point {shape-type: triangle; rotation: 180;}'], 
      [7, 2.5, null], 
      [8, 3, null] 
    ]); 

    var options = { 
     legend: 'none', 
     hAxis: { minValue: 0, maxValue: 9 }, 
     curveType: 'function', 
     pointSize: 7 
    }; 

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

在的jsfiddle - https://jsfiddle.net/7bc691kr/

感謝

回答

1

在它看起來像旋轉選項各個點選項被稱爲shape-rotation,而不是僅僅rotation

更改您的rotation: 180shape-rotation: 180它應該工作。

+0

謝謝!它工作完美。 – Matt