syampillai/SOCharts

Setting a global font for the chart has no effect

yusufnazir opened this issue · 1 comments

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.

Thanks for reporting. I have corrected this in version 3.2.3