I’m working with ApexCharts and I’m facing an issue where the y-axis label color isn’t being applied. The x-axis color is working correctly, though.
Here’s the relevant code snippet:
<code>// Setting x-axis labels
XAxis xAxis = XAxisBuilder.get()
.withCategories(continuous.size() > oneTime.size() ? continuousKeys : oneTimeKeys)
.withTooltip(TooltipBuilder.get().withEnabled(false).build())
.withLabels(com.github.appreciated.apexcharts.config.xaxis.builder.LabelsBuilder.get()
.withStyle(StyleBuilder.get()
.withColors(IntStream.range(0, xSize).mapToObj(x -> "#FFFFFF").collect(Collectors.toList()))
.build())
.build())
.build();
chart.setXaxis(xAxis);
// Setting y-axis labels
YAxis yAxis = YAxisBuilder.get()
.withLabels(LabelsBuilder.get()
.withFormatter(
"function(val) { if (val >= 1000000) { return (val / 1000000).toFixed(1) + 'M'; } else { return val / 1000 + 'K'; } }")
.withStyle(com.github.appreciated.apexcharts.config.yaxis.labels.builder.StyleBuilder.get()
.withColor("#FFFFFF").build())
.build())
.withTooltip(TooltipBuilder.get().withEnabled(false).build())
.build();
chart.setYaxis(new YAxis[] { yAxis });
</code>
<code>// Setting x-axis labels
XAxis xAxis = XAxisBuilder.get()
.withCategories(continuous.size() > oneTime.size() ? continuousKeys : oneTimeKeys)
.withTooltip(TooltipBuilder.get().withEnabled(false).build())
.withLabels(com.github.appreciated.apexcharts.config.xaxis.builder.LabelsBuilder.get()
.withStyle(StyleBuilder.get()
.withColors(IntStream.range(0, xSize).mapToObj(x -> "#FFFFFF").collect(Collectors.toList()))
.build())
.build())
.build();
chart.setXaxis(xAxis);
// Setting y-axis labels
YAxis yAxis = YAxisBuilder.get()
.withLabels(LabelsBuilder.get()
.withFormatter(
"function(val) { if (val >= 1000000) { return (val / 1000000).toFixed(1) + 'M'; } else { return val / 1000 + 'K'; } }")
.withStyle(com.github.appreciated.apexcharts.config.yaxis.labels.builder.StyleBuilder.get()
.withColor("#FFFFFF").build())
.build())
.withTooltip(TooltipBuilder.get().withEnabled(false).build())
.build();
chart.setYaxis(new YAxis[] { yAxis });
</code>
// Setting x-axis labels
XAxis xAxis = XAxisBuilder.get()
.withCategories(continuous.size() > oneTime.size() ? continuousKeys : oneTimeKeys)
.withTooltip(TooltipBuilder.get().withEnabled(false).build())
.withLabels(com.github.appreciated.apexcharts.config.xaxis.builder.LabelsBuilder.get()
.withStyle(StyleBuilder.get()
.withColors(IntStream.range(0, xSize).mapToObj(x -> "#FFFFFF").collect(Collectors.toList()))
.build())
.build())
.build();
chart.setXaxis(xAxis);
// Setting y-axis labels
YAxis yAxis = YAxisBuilder.get()
.withLabels(LabelsBuilder.get()
.withFormatter(
"function(val) { if (val >= 1000000) { return (val / 1000000).toFixed(1) + 'M'; } else { return val / 1000 + 'K'; } }")
.withStyle(com.github.appreciated.apexcharts.config.yaxis.labels.builder.StyleBuilder.get()
.withColor("#FFFFFF").build())
.build())
.withTooltip(TooltipBuilder.get().withEnabled(false).build())
.build();
chart.setYaxis(new YAxis[] { yAxis });
In this code, I’m setting the color for the y-axis labels to white (#FFFFFF), but they are not changing color. I expect them to be white, but they remain the default color.