mariusmuntean / ChartJs.Blazor

Brings Chart.js charts to Blazor
https://www.iheartblazor.com/
MIT License
677 stars 151 forks source link

Change X and Y axis font color #71

Closed ItsMeDan11 closed 4 years ago

ItsMeDan11 commented 4 years ago

I'm trying out the simple bar chart from the demo as a Blazor server experiment. Looks really good, but I can't figure out how to change the colors used for the text on the axis and data labels. Is there an example I can look to?

Joelius300 commented 4 years ago

Thanks for contacting us!

I'm not sure what exactly you mean. As always when you don't know how to do something with this library, I'd advise you to look into the Chart.js docs and play around with their samples (sample sources). Once you understand how to do it with plain javascript, you can try to emulate it within this library; the location of the properties and the names should be the same (except for camel- vs PascalCasing). However it's very possible that we don't have the property that you need or we have it but it's just wrong (unfortunately there are still quite a few mistakes).

Do you have javascript code you could show me so I understand what effect you're trying to achieve? If not, could you maybe try to create an example (as code or e.g. JSFiddle) which demonstrates your use-case?

ItsMeDan11 commented 4 years ago

I had a little more of a chance to play around and love this library, but I still can't see where to add the color. In javascript it would look something like this.

yAxes: [{ ticks: { beginAtZero:true, fontColor: 'red' },

In the bar chart I'm using, I can see the beginAtZero property, but it won't compile if I add font color property.

Here is what I have currently that works. Axes = new List { new BarLinearCartesianAxis { Ticks = new LinearCartesianTicks { BeginAtZero = true } } }

Joelius300 commented 4 years ago

You're doing it right but I'm sure you're using the nuget and not the newest (inofficial) version where this is fixed. The commit 283666c4 added the missing options and fixed the inheritance. Once a new nuget releases you can use the FontColor property :)
Until then you'll have to manually build the library from the newest sources and reference it.

It was already asked on gitter; I sadly don't know when a new nuget version will release. I won't close the issue but if you want you can close it already - the nuget will be updated eventually.

ItsMeDan11 commented 4 years ago

Thanks. I'll try that.

steamonimo commented 4 years ago

The current nuget release is from 12/13/2019. When will the nuget with support for the FontColor in Ticks be released?

Joelius300 commented 4 years ago

Good question. Sadly, I don't have the answer to that nor access to our nuget site.

@mariusmuntean Can you answer that question? Also how are we going to proceed with the nuget releases in general, you don't seem to be able to do it frequently :/