syampillai / SOCharts

A wrapper around the "echarts" JavaScript library to use it as a Vaadin component.
Apache License 2.0
27 stars 11 forks source link

Setting a global font for the chart has no effect #21

Closed yusufnazir closed 1 year ago

yusufnazir commented 1 year ago

Seems the textStyle generated for the chart is an array:

"textStyle": [{
    "fontStyle": "normal",
    "fontFamily": "system-ui",
    "fontSize": "medium"
  }]

but according the documentation is should not be an array. I played around with the code by commenting out the line

new ComponentEncoder("textStyle", DefaultTextStyle.class),

in the SoChart class and updated the code in the update method:

 StringBuilder sb = new StringBuilder();
    sb.append("{");
        if(defaultTextStyle != null) {
             ComponentPart.encode(sb, "textStyle", defaultTextStyle);
             sb.append(",");
        }
        sb.append("\"dataset\":{\"source\":{");

This has the desired affect. Not sure if this is the way to go though.

syampillai commented 1 year ago

Thanks for reporting. I have corrected this in version 3.2.3