[英]Google charts, problematically get trend line value for first and last points
google.charts.load('current', { packages: ['corechart', 'line'] });
google.charts.setOnLoadCallback(drawCurveTypes);
function drawCurveTypes() {
data = new google.visualization.DataTable();
data.addColumn('date', 'Period');
data.addColumn('number', 'AveragePricePaid');
for (i = 0; i < rollingyears; i++) {
data.addRows([
[new Date(Fperioddata[i]), Faveragedata[i]]
]);
}
var options = {
title: 'Average Price Paid (Rolling Year)',
hAxis: { title: 'Rolling Year' },
vAxis: { title: 'Average Price Paid' },
//legend: 'none',
height: 300,
width: 520,
pointSize: 10,
pointShape: 'square',
trendlines: { 0: { color: 'green', pointSize: 2, pointShape: 'square', showR2: true, visibleInLegend: true} }
};
上面的代碼有效,並提供了一條帶有趨勢線的圖形。 我需要能夠獲得第一個和最后一個趨勢線點的值。
我需要獲得這些而不必單擊圖表。 理想情況下,同時生成圖形。 這可能嗎?
我設法通過以編程方式計算趨勢線而不是使用內置函數來解決了該問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.