AAChartCore
AAChartCore copied to clipboard
Pie Chart Tooltip Customization?
EDIT: OK, so apparently I got it all wrong and the last part is what takes care of some of the tooltip. ๐ถ But still I can't manage to format it.
new AAPie()
.name("ืงืืื ืคืืืฉืืช") //The title in the tooltip. Removing it will result in "Series [num]:"
.dataLabels(new AADataLabels() //The labels as they appear in the chart
.enabled(true)
.useHTML(true)
.distance(5f)
.format(":<b>{point.name}</b> <br> {point.percentage:.1f} %")) //The format of the labels OUTSIDE the popup tooltip
.data(new Object[][] {
{"ืืชืงืืืื", meetings_occurred},
{"ืืืืื", meetings_not_occurred},
})
Thanks for the neat library. As I'm not a Chinese speaker, I think I might have missed any documentation of this issue, so I'd love get some help.
TL;DR - I would love to get some example of how to customize a tooltip of an existing pie chart OR how to create a pie chart with a tooltip as the default, but that answers different needs (such as mine).
I have a simple pie chart, and the default tooltip options suit me up to size and rtl language handling. I'm using Hebrew and possibly later also Arabic which are RTL written, and I get some language mess-ups.
This is what I get:
Now, it's probably hard to understand what's the problem, but in analog to English I get something like: 8 Meeting dhappene๐ขccurence: o
While the desired is something like: Meeting occurrence ๐ข 8 happened
So basically the issue is that I haven't managed to customize the tooltip, but it seems to be customize-able. Anything that might help me get the text in a single line without reversing text is good - size changes, line breaks, etc - but I have no clue of where to find it.
This is what I coded: (Sorry for the C++ conventions ๐ , it's my first time in Java and it was written before getting acquainted with Java's)
AAChartModel occurrence_chart_model = new AAChartModel()
.chartType(AAChartType.Pie)
.animationType(EaseInCirc)
.title(occurrence_title)
.titleFontColor("#6f79a8")
.titleFontSize(16f)
.subtitle(subtitle)
.subtitleFontColor("#6f79a8")
.subtitleFontSize(12f)
.dataLabelsEnabled(true)
.dataLabelsFontColor("#7B8D93")
.colorsTheme(new Object[]{"#33CC5A", "#BA160C"})
.legendEnabled(true)
.series(new AAPie[]{
new AAPie()
.name("ืงืืื ืคืืืฉืืช")
.dataLabels(new AADataLabels()
.enabled(true)
.useHTML(true)
.distance(5f)
.format(":<b>{point.name}</b> <br> {point.percentage:.1f} %"))
.data(new Object[][] {
{"ืืชืงืืืื", meetings_occurred},
{"ืืืืื", meetings_not_occurred},
})
});
occurrence_chart_view.aa_drawChartWithChartModel(occurrence_chart_model);
Thanks in advance.