我正在使用HighChart在Android设备上呈现图形。但是第一次,当数据点超过10k时,它不会显示所有数据点。当我尝试放大或缩小几次时,所有数据点都可见。我需要至少有5万个点的图形。我正在测试HighChartjs提供的示例代码。
public class MainActivity extends AppCompatActivity {
private ArrayList dataList;
int noOfData = 50000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dataList = data();
HIChartView chartView = findViewById(R.id.hc);
chartView.plugins = new ArrayList<>(Arrays.asList("boost"));
HIOptions options = new HIOptions();
HIChart chart = new HIChart();
chart.setType("line");
chart.setZoomType("x");
options.setChart(chart);
HIBoost boost = new HIBoost();
boost.setUseGPUTranslations(true);
options.setBoost(boost);
HITitle title = new HITitle();
options.setTitle(title);
HISubtitle subtitle = new HISubtitle();
subtitle.setText("Using the Boost module");
options.setSubtitle(subtitle);
HITooltip tooltip = new HITooltip();
tooltip.setValueDecimals(2);
options.setTooltip(tooltip);
HILine line = new HILine();
line.setData(dataList);
int noOfData = this.dataList.size();
title.setText("Highcharts drawing " +noOfData +" points");
line.setLineWidth(1);
options.setSeries(new ArrayList<HISeries>(Collections.singletonList(line)));
chartView.setOptions(options);
}
private ArrayList data(){
ArrayList dataList = new ArrayList();
for (int i = 0; i < noOfData; i++) {
dataList.add(i, (Math.random() * 100));
}
return dataList;
}
}
获取错误日志:Highcharts错误#26:www.highcharts.com/errors/26
E / Highcharts:未捕获的TypeError:无法读取未定义的属性'forEach'