AAChartModel / AAChartKit

📈📊🚀🚀🚀An elegant modern declarative data visualization chart framework for iOS, iPadOS and macOS. Extremely powerful, supports line, spline, area, areaspline, column, bar, pie, scatter, angular gauges, arearange, areasplinerange, columnrange, bubble, box plot, error bars, funnel, waterfall and polar chart types. 极其精美而又强大的现代化声明式数据可视化图表框架,支持柱状图、条形图、折线图、曲线图、折线填充图、曲线填充图、气泡图、扇形图、环形图、散点图、雷达图、混合图等各种类型的多达几十种的信息图图表,完全满足工作所需.
https://cocoapods.org/pods/AAChartKit
MIT License
4.71k stars 750 forks source link

嵌套柱状图柱子层级调整 #1555

Closed Zorodon closed 1 month ago

Zorodon commented 1 month ago

WeChate55ceaf8fbff53e353bd2d1069426092 作者大大,怎么实现嵌套柱状图柱子层级调整啊,如图这种数列,有大有小,按demo搞的嵌套后面的柱子会被前面的挡住,怎么调整到前面来?就是不管几列,小的数据搞到前面,大的在后面

AAChartModel commented 1 month ago

你是想要实现 Highcharts 嵌套柱状图中柱子层级根据数值大小自动调整,确保小的数据对应的柱子显示在前面,大的在后面,不会被遮挡,对吧?

但是 Highcharts 本身应该是没有直接提供这个功能(我还没有找到相关资料).

我感觉要实现的你的这个效果, 只能靠你自己对数据排序做预处理.

Zorodon commented 1 month ago

对啊,是想实现那种效果,有想过预先处理数据,但是后面tooltip也要处理,啊,头疼头疼

AAChartModel commented 1 month ago

这个没办法🤷‍♂️. 但是 Highcharts 不是支持调整柱状图宽度吗? 处在后面的偏矮的柱状图只要够宽, 也一样能够被看到啊.

AAChartModel commented 1 month ago

这个没办法🤷‍♂️. 但是 Highcharts 不是支持调整柱状图宽度吗? 处在后面的偏矮的柱状图只要够宽, 也一样能够被看到啊.

类似于这种: 偏矮的棱柱, 即便在后方, 因为足够宽, 也一样能够被看见.

Zorodon commented 1 month ago

我一开始就是处理成这种不等宽的,设计师说丑,不要啊,必须要等宽TT。如果处理数据,弄成大的一列,小的一列,然后标志哪个是换过的,处理完数据,这个tooltip有办法根据标志来提示替换的值吗?

AAChartModel commented 1 month ago

AADataElement 的确实有 name 属性, 你可以先通过设置每个 AADataElement 的对应的 name 值, 来对数据进行分类,


@interface AADataElement : NSObject

AAPropStatementAndPropSetFuncStatement(copy  , AADataElement, NSString *, color)
AAPropStatementAndPropSetFuncStatement(strong, AADataElement, AADataLabels *, dataLabels)
AAPropStatementAndPropSetFuncStatement(strong, AADataElement, AAMarker *, marker)
AAPropStatementAndPropSetFuncStatement(copy  , AADataElement, NSString *, name)
AAPropStatementAndPropSetFuncStatement(strong, AADataElement, NSNumber *, x)
AAPropStatementAndPropSetFuncStatement(strong, AADataElement, NSNumber *, y)
AAPropStatementAndPropSetFuncStatement(strong, AADataElement, id,         selected)

@end

然后通过 AATooltipformatter 方法, 来自定义 tooltip.

AAChartModel commented 1 month ago

至于如何通过 AATooltipformatter 自定义 浮动提示框内容, 参考 demo 中的这些示例方法

AAChartModel commented 1 month ago

参考在线文档:

Zorodon commented 1 month ago

大大,求助,怎么让AAColumn每列都配置自己的颜色,我数据替换了,但是柱子颜色怎么换?

AAChartModel commented 1 month ago

AADataElementcolor 属性, 具体设置方法参考:

AAChartModel commented 1 month ago

在线文档参考:

Zorodon commented 1 month ago

感谢大佬,搞定啦,谢谢