[英]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.