0

ZK Charts Change Font size of Labels

asked 2019-07-24 09:59:52 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2621 3 8
http://emrpms.blogspot.in...

Please look at the picture and code. Any idea how to change the font size

image description

public void showSummaryByDenial() {
    SimpleSingleValueCategoryModel model;
    chartDenial = new Charts();
    chartDenial.setTitle(" ");
    chartDenial.setParent(divSummaryByDenial);
    chartDenial.setType("pie");
    chartDenial.setBorderColor("#ffffff");
    chartDenial.setBorderWidth(0);
    chartDenial.setHeight(240);

    chartDenial.getExporting().setEnabled(false);
    this.dataByDenial = false;
    this.searchConditions.setSummaryType("insurance");
    this.denialList = Services.getDashboardService().getDashboardDenialByCode(searchConditions);
    if (denialList.size() > 0)
        this.dataByDenial = true;
    model = new SimpleSingleValueCategoryModel();
    for (ChartDataList chartDataList : denialList) {
        model.setValue(chartDataList.getData(), chartDataList.getAmount());
    }
    chartDenial.setModel(model);
    Chart chartOptional = chartDenial.getChart();
    chartOptional.setPlotBorderWidth(0);
    chartOptional.setBackgroundColor("");
    chartDenial.getTooltip().setPointFormat("  <b>{point.percentage:.1f}%</b>");
    PiePlotOptions plotOptions = chartDenial.getPlotOptions().getPie();
    plotOptions.setAllowPointSelect(true);
    plotOptions.setCursor("pointer");
    plotOptions.getDataLabels().setEnabled(true);
    plotOptions.setShowInLegend(false);
    chartDenial.setTheme(Theme.DEFAULT);
}
delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-07-24 15:02:59 +0800

cor3000 gravatar image cor3000
4952 2 7
ZK Team

updated 2019-07-24 15:09:08 +0800

It looks like you, almost got there. You already found the dataLabels object in plotOptions. In addition to enabling them you can also define styles by calling setStyle(...).

https://www.zkoss.org/javadoc/latest/zkcharts/org/zkoss/chart/plotOptions/DataLabels.html#setStyle-java.lang.String-

Here a native example for highcharts: https://jsfiddle.net/p312jw9t/

in ZkCharts this becomes:

plotOptions.getDataLabels().setStyle(Collections.singletonMap("fontSize", "20px"));

or

plotOptions.getDataLabels().setStyle("fontSize: 20px;");

Since it seems too simple to be true:

Did you already try that? Was there a problem/unexpected result?

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2019-07-24 09:59:52 +0800

Seen: 5 times

Last updated: Jul 24

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More