简体   繁体   English

Angular Highcharts-ng如何设置其他数据系列作为工具提示

[英]Angular Highcharts-ng how to set additional data series as tooltip

I have an array of data for values and an array of data for sample counts and I would like to display both in the tooltip for the point on the line chart. 我有一个用于值的数据数组和一个用于样本计数的数据数组,我想在工具提示中同时显示折线图上该点的位置。

I am using a web call to populate the arrays of data using an angular.forEach loop. 我正在使用web调用使用angular.forEach循环填充数据数组。 I then set the data series of the chart as: 然后,将图表的数据系列设置为:

var all_values= [];
var all_samples= [];
var timespan= [];

angular.forEach($scope.data, function (value, key) {
  all_values.push(value.All_Values); //y axis values
  all_samples.push(value.All_Samples); //additional tooltip data
  timespan.push(values.TimeSpan); //this is for the x axis
});

$scope.chartConfig.series[0].data = all_values;

All of this works fine but how can I get my all_samples to be included in the data series so that I can display it on the tooltip? 所有这些都可以正常工作,但是如何将我的all_samples包含在数据系列中,以便可以在工具提示上显示它?

If you want to display extra info in tooltip, then you need to set custom pointFormat / pointFroamtter / format / formatter - depends how much you would like to change tooltip display. 如果要在工具提示中显示其他信息,则需要设置自定义pointFormat / pointFroamtter / format / formatter取决于要更改工具提示显示的数量。 Next, you could have external array for extra info or you could just add more properties to each data point. 接下来,您可以使用外部数组获取更多信息,也可以仅向每个数据点添加更多属性。 If you are using arrays for data points, then use keys . 如果将数组用于数据点,请使用keys

Example: http://jsfiddle.net/ge2rbgt9/ 示例: http//jsfiddle.net/ge2rbgt9/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM