Change font color to Bars


I know this may sound picky for someone. But we are migrating an existing app to a new UI design provided. So far we have accomplished most of the items but there are some that we don’t know how to do like for example change the axis font size and color of a bars visualization like this:

Does chartfactor provides any config for this? I’ve been looking in the doc but can’t find anything


I saw that these visualizations are canvas based and they are built using echarts. Take a look here on how to do that.


Yeah, but this is Echarts documentation which btw, had no Idea where to look for. In CF doc I can’t find anything about it.


As @oliver mentioned, the standard package is mostly based on echarts. So you can access the echarts options for a given visualization like this:

const mychart = cf.getVisualization('div-element-id')
const options = mychart.get('__CHART__')

And in the options object you will have the full echarts configuration for that instance. You can modify the configurations and set it back in a similar fashion:

myChart.set('__CHART__', options)

The documentation for every parameter and configuration for Echarts is the same link provided by @oliver.


Thanks @eduardo, that helps. The problem is that is done once the visualization is created and rendered. Is there any way to do that from the beginning? The other thing is that I haven’t found the right configuration, echarts has soooo many, but at least I have something to test.


If you use the execute:stop event as discussed here to modify the visual in an early stage it may work.


@lennydev, Any luck on how to configure the fonts colors? I’m working on a Scatter Plot but I guess it will be the same.


Yes, Echarts documentation is extensive but once you learn how to use it becomes easier. I haven’t tried with other visualization besides the Bars, but I guess it will be the same. Here is the how I did it (combined with @eduardo and @william solutions):

    .on('execute:stop', () => {
            const options = mychart.get('__CHART__');

            opts.yAxis[0].axisLine.lineStyle.color = color;
            opts.yAxis[0].axisTick.lineStyle.color = color;
            opts.xAxis[0].axisLine.lineStyle.color = color;
            opts.xAxis[0].axisTick.lineStyle.color = color;
            opts.xAxis[0].axisLabel.fontSize = 11;
            opts.yAxis[0].axisLabel.fontSize = 11;
            opts.yAxis[0].axisLabel.margin = 11;

            myChart.set('__CHART__', options)