AnyChart / AnyChart-Android

AnyChart Android Chart is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 19+ (Android 4.4) and features dozens of built-in chart types.
2.32k stars 369 forks source link

Treemap customize scale color value #221

Closed leilasdq closed 3 years ago

leilasdq commented 3 years ago

Hello. Is there any way to make color scale work base on another parameter not just the given value?

leilasdq commented 3 years ago

I don't know if it is best solution but I found a way to solve my problem. What I wanted was to change color by another value I give to it, different from value property.

As I read treemap examples at https://playground.anychart.com/tags/treemap-chart I found out if you have size property and a value, box size will define by size and value will use just for coloring. So for this situation I made a class extended from TreeDataEntry and use below code:

private inner class CustomTreeDataEntry(id: String?, parent: String?, value: Int?, changePercent: Float) : TreeDataEntry(id, parent, value) { init { setValue("changePercent", changePercent) setValue("size", value) setValue("value", changePercent) } }