在iOS中的工具提示中添加不属于图表的x和y轴的其他数据 [英] Add additional data to tooltip in iOS which does not belongs to x&y-axis of graph
问题描述
我按照此演示绘制了柱形图. ( https://www.highcharts.com/ios/demo/column-rotated -标签).
I followed this demo to draw Column charts. (https://www.highcharts.com/ios/demo/column-rotated-labels).
我面临的问题是:我可以轻松地在工具提示中显示x轴和y轴信息.但是我无法从其他数组(假设数组用于描述项目所需的数量)将其他信息放入工具提示中.
What Issue I am facing is : I can easily show x-axis and y-axis information in tooltip. But I am not able to put additional information in tooltip from a different array (suppose array for depicting required qty for item).
我试图这样做;
tooltip.pointFormat = [NSString stringWithFormat:@速度:{point.y:.2f} 剩余数量:%@,RemainingQtyArray]; 它将在工具提示中打印整个数组. tooltip.pointFormat = [NSString stringWithFormat:@速度:{point.y:.2f} 剩余数量:%@,RemainingQtyArray [i ++]]; 它将打印数组中的最后一项. 因此,我该如何放置其他信息,以便当任何人点击图形时,它也会显示此信息.
tooltip.pointFormat = [NSString stringWithFormat:@"Velocity : {point.y:.2f} Remaining Quantity : %@",RemainingQtyArray]; It will print whole array in tooltip. tooltip.pointFormat = [NSString stringWithFormat:@"Velocity : {point.y:.2f} Remaining Quantity : %@",RemainingQtyArray[i++]]; It will print last item from array. So, how can i put additional info so that when anyone taps on graph, it will show this info too.
想要这样的工具提示.
推荐答案
在 Fiddle 演示中进行检查JS
Check this Fiddle demo in JS
JS方式的工具提示
tooltip: {
pointFormat: 'Population in 2017: <b>{point.y:.1f} millions</b><br>Extra One: <b>{point.data1}</b><br>Extra Two: <b>{point.data2}</b>'
},
以JS方式进行系列数据
Series data in JS way
data: [
{name:'Shanghai', y:24.2,data1:'Aa',data2:'Ba'},
{name:'Beijing', y:20.2,data1:'Ab',data2:'Bb'},
{name:'Karachi', y:14.2,data1:'Ac',data2:'Bc'},
{name:'Shenzhen', y:13.2,data1:'Ad',data2:'Bd'},
],
通过 doc 我将其转换为ios.
Through doc I convert into ios.
对于iOS
HITooltip *tooltip = [[HITooltip alloc]init];
tooltip.pointFormat = @"Population in 2017: <b>{point.y:.1f} millions</b><br>Extra One: {point.data1}<br>Extra Two: {point.data2}";
用于iOS系列数据
column.data = [NSMutableArray arrayWithObjects:
@{
@"name":@"Shanghai",
@"y":@23.7,
@"data1":@'Aa',
@"data2":@'Ba'
},
@{
@"name":@"Shanghai",
@"y":@16.1,
@"data1":@'Aa',
@"data2":@'Ba'
},
@{
@"name":@"Karachi",
@"y":@14.2,
@"data1":@'Aa',
@"data2":@'Ba'
},
@{
@"name":@"Shenzhen",
@"y":@14,
@"data1":@'Aa',
@"data2":@'Ba'
}
, nil];
这篇关于在iOS中的工具提示中添加不属于图表的x和y轴的其他数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!