-
-
Notifications
You must be signed in to change notification settings - Fork 753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
可以自定义tooltip的显示格式吗 #375
Comments
可以啊,里面有自定义 tooltip 浮动提示框的示例,示例代码如下: - (AAOptions *)configureCustomStyleTooltipChart {
AAChartModel *aaChartModel = AAObject(AAChartModel)
.chartTypeSet(AAChartTypeArea)//图表类型
.titleSet(@"近三个月金价起伏周期图")//图表主标题
.subtitleSet(@"金价(元/克)")//图表副标题
.colorsThemeSet(@[@"#FFD700"/*(纯金色)*/,@"#ffc069",@"#06caf4",@"#7dffc0"])//设置主体颜色数组
.symbolStyleSet(AAChartSymbolStyleTypeBorderBlank)//折线连接点样式为外边缘空白
.xAxisTickIntervalSet(@15)//x轴刻度点间隔数(设置每隔几个点显示一个 X轴的内容)
.yAxisTitleSet(@"")//设置 Y 轴标题
.yAxisGridLineWidthSet(@0.8)//y轴横向分割线宽度(为0即是隐藏分割线)
.categoriesSet(@[
@"10-01",@"10-02",@"10-03",@"10-04",@"10-05",@"10-06",@"10-07",@"10-08",@"10-09",@"10-10",@"10-11",
@"10-12",@"10-13",@"10-14",@"10-15",@"10-16",@"10-17",@"10-18",@"10-19",@"10-20",@"10-21",@"10-22",
@"10-23",@"10-024",@"10-25",@"10-26",@"10-27",@"10-28",@"10-29",@"10-30",@"10-31",@"11-01",@"11-02",
@"11-03",@"11-04",@"11-05",@"11-06",@"11-07",@"11-08",@"11-09",@"11-10",@"11-11",@"11-12",@"11-13",
@"11-14",@"11-15",@"11-16",@"11-17",@"11-18",@"11-19",@"11-20",@"11-21",@"11-22",@"11-23",@"11-024",
@"11-25",@"11-26",@"11-27",@"11-28",@"11-29",@"11-30",@"12-01",@"12-02",@"12-03",@"12-04",@"12-05",
@"12-06",@"12-07",@"12-08",@"12-09",@"12-10",@"12-11",@"12-12",@"12-13",@"12-14",@"12-15",@"12-16",
@"12-17",@"12-18",@"12-19",@"12-20",@"12-21",@"12-22",@"12-23",@"12-024",@"12-25",@"12-26",@"12-27",
@"12-28",@"12-29",@"12-30"])
.seriesSet(@[
AAObject(AASeriesElement)
.lineWidthSet(@1.5)
.fillOpacitySet(@0.4)
.nameSet(@"2018")
.dataSet(
@[@1.51, @6.7, @0.94, @1.44, @1.6, @1.63, @1.56, @1.91, @2.45, @3.87, @3.24, @4.90, @4.61, @4.10,
@4.17, @3.85, @4.17, @3.46, @3.46, @3.55, @3.50, @4.13, @2.58, @2.28,@1.51, @12.7, @0.94, @1.44,
@18.6, @1.63, @1.56, @1.91, @2.45, @3.87, @3.24, @4.90, @4.61, @4.10, @4.17, @3.85, @4.17, @3.46,
@3.46, @3.55, @3.50, @4.13, @2.58, @2.28,@1.33, @4.68, @1.31, @1.10, @13.9, @1.10, @1.16, @1.67,
@2.64, @2.86, @3.00, @3.21, @4.14, @4.07, @3.68, @3.11, @3.41, @3.25, @3.32, @3.07, @3.92, @3.05,
@2.18, @3.24,@3.23, @3.15, @2.90, @1.81, @2.11, @2.43, @5.59, @3.09, @4.09, @6.14, @5.33, @6.05,
@5.71, @6.22, @6.56, @4.75, @5.27, @6.02, @5.48])
]
);
/*Custom Tooltip Style --- 自定义图表浮动提示框样式及内容*/
AAOptions *options = [AAOptionsConstructor configureChartOptionsWithAAChartModel:aaChartModel];
AATooltip *tooltip = options.tooltip;
tooltip
.useHTMLSet(true)
.headerFormatSet(@"{series.name}-<b>{point.key}</b>  12:00<br>")
.pointFormatSet(@"<b>{point.y}</b> 元/克")
.valueDecimalsSet(@2)//设置取值精确到小数点后几位
.backgroundColorSet(@"#000000")
.borderColorSet(@"#000000")
.styleSet(@{@"color":@"#FFD700"/*(纯金色)*/,
@"fontSize":@"12px",})
;
return options;
} 其中主要是通过这一段代码来自定义 tooltip (浮动提示框) AATooltip *tooltip = options.tooltip;
tooltip
.useHTMLSet(true)
.headerFormatSet(@"{series.name}-<b>{point.key}</b>  12:00<br>")
.pointFormatSet(@"<b>{point.y}</b> 元/克")
.valueDecimalsSet(@2)//设置取值精确到小数点后几位
.backgroundColorSet(@"#000000")
.borderColorSet(@"#000000")
.styleSet(@{@"color":@"#FFD700"/*(纯金色)*/,
@"fontSize":@"12px",})
; |
这样,点击每一条信息显示的内容是一定的(X轴、Y轴、及值),我想要那种,点击不同信息,能不能显示更多的信息(除X轴、Y轴、值以外的其他内容)????? |
这个估计就比较困难了.
这里是 Highcharts 官网中格式化自定义 tooltip 的两个参数示例文档,你可以找找,是否有你自己想要的,如果有的话, AAChartKit 实现起来应该难度不大,如果没有的话,那么 AAChartKit 也无法做到超出 Highcharts 本身功能特性以外的事情的. |
好的,谢谢 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
可以自定义tooltip的显示格式吗。
tooltip 显示的内容不仅仅包括 X 轴 与 Y 轴 的数据,需要加入其他的描述信息
The text was updated successfully, but these errors were encountered: