-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question How to change chart axis color #1067
Comments
Based on this answer https://stackoverflow.com/questions/41958548/chartjs-change-axis-line-color it should be something like this: <LineChart @ref="lineChart" TItem="double" Options="@options" />
@code{
ChartOptions options = new LineChartOptions
{
Scales = new Scales {
XAxes = new List<Axis> {
new Axis {
GridLines = new AxeGridLines {
Color = "#131c2b"
}
}
},
YAxes = new List<Axis> {
new Axis {
GridLines = new AxeGridLines {
Color = "#131c2b"
}
}
}
}
};
} |
Thanks but it didn't work
|
This works <LineChart @ref="lineChart" TItem="double" Options="@options" />
@code{
LineChartOptions options = new LineChartOptions
{
Scales = new Scales
{
XAxes = new List<Axis> {
new Axis {
GridLines = new AxeGridLines {
Color = "#ff0000"
}
}
},
YAxes = new List<Axis> {
new Axis {
GridLines = new AxeGridLines {
Color = "#00ff00"
}
}
}
}
};
} |
That's really weird, I'm using demo bootstrap RC, didn't work in Opera and Edge. |
Nothing actually. Those are the only changes I have done in the demo app. |
In another test project, I'm using another ChartJS library, and I could customize font colors fine so its not my system. https://github.com/mariusmuntean/ChartJs.Blazor I also noticed you are not using latest version of chartjs, it looks like 2.9.3 now |
So, I included latest version of chartjs |
No idea, can you please send me a release bin and I try to run on my side? |
It should be on visible on |
Thanks, I noticed something weird from your Debug.zip
Since the beginning, I couldn't get Blazorise.Demo.Bootstrap to run, It will give me this So I'm using the server hosted Blazorise.Demo.Bootstrap.RC instead. My own project where I setup webassembly with blazorise, it works fine.
It seems you are not running from master branch, I'm running directly from master branch, |
|
I don't understand, why can't we run webassembly directly? In my own project which is netstandard2.1, I can run fine and Publish to a folder and deploy. |
You have probably selected WebAssembly project without net core part when you have first created your project. Blazor comes with three project templates. WebAssembly, WebAssembly + NetCore host, and Blazor Server. |
Check your |
I already mention it, you should run it on |
It seems But anyways I think we stranded far from original problem. |
I agree. I'm not sure what the Debug.zip you pass me will do. If I run Blazorise.Demo.Bootstrap.Server from Visual studio, the IIS Express is tied to that. I replace the bin folder and no difference. What I really wanted was a Published webassembly build from you, so I can run it on a local webserver to check. |
So I try the PieChart, and it seem that the Options are not completely mapped? Eg. E.g Legend has Labels object that can customize color but I don't see it in https://www.chartjs.org/docs/latest/configuration/legend.html#legend-label-configuration |
Could be they added more options for Btw, do you still have original problem with axis color? |
Yes, not resolved. I'm trying other parts of chartjs to learn about it. |
Hi, I'm trying to change the chart axis color, I do this, it is null object reference.
I put on OnAfterRenderAsync, it also null object error.
I'm thinking of using the Labels/Dataset, but they are protected, not public
The text was updated successfully, but these errors were encountered: