Cannot set color to yaxis label
karl9821 opened this issue · 3 comments
karl9821 commented
this is my code for setting up yaxis
` // 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 });`
This is the result i can change the xaxis color but it does not seem to work on the yaxis label
karl9821 commented
After encountering an issue with ApexCharts where the y-axis label font color wasn't being applied, I found an alternative solution. By setting the theme to dark mode, which made all fonts white, and adjusting the background of the chart to match my page, I achieved the desired result.
Loahrs commented
Another solution would be to set a cssClassName:
.withYaxis(YAxisBuilder.get()
.withLabels(LabelsBuilder.get()
.withStyle(StyleBuilder.get()
.withCssClass("custom-y-axis-label")
.build())
.build())
.build())
.build()
and then you can change the textcolor like:
.custom-y-axis-label{
fill: orange;
}
karl9821 commented
the css works ty