Comments (4)
@Joelius300, Thank you so much for the swift reply, along with the simple work around, I appreciate it. As you have stated adding the Offset=true did in fact work in my project as well.
Thanks again.
from chartjs.blazor.
That was an oversight on my part.
I've reintroduced the T4 template and adjusted it such that the category axis for bar charts is initialized with the Offset
property set to true
.
from chartjs.blazor.
Thank you for the detailed report! It really helps to know all those details when providing support.
You're correct that this is a bug but probably not in the sense you think.
This is the expected behaviour when using a cartesian axis that has the property Offset
(or offset
on js-side) set to false
. The thing is, we've written in the property summary that this is set to true
in category scales for bar-charts by default. However, the default for all the other cartesian axes is false
and we (actually it was me) forgot to manually change it when I created the extended versions for the bar chart.
So even though you're using a category axis in a bar chart (which should satisfy what we wrote) Offset
stays false
.
FYI here's the property summary for CartesianAxis.Offset
:
If true, extra space is added to the both edges and the axis is scaled to fit into the chart area.
This is set to true for a category scale in a bar chart by default.
This is fixed easily by just setting Offset
to true
in BarCategoryAxis
s constructor. However, we need to keep in mind that if you use a regular CategoryAxis
in a bar-chart, Offset
will still be set to false
. Therefore we also need to update the summary to make that clear.
I will provide a fix for this (after the other thing is cleared up, see below). I don't know when it'll be updated in the nuget.
To work around the issue you can manually set Offset = true
in the x-axis (BarCategoryAxis
) you add in your chart (just add it to the other initalization options like BarPercentage = 0.5
). I've tested it and it works exactly like expected.
@mariusmuntean When looking at this issue I've noticed that you've removed the ExtendedCartesianAxes.tt
in 88ed13d which generated the extended versions of the cartesian axes for the bar chart. May I ask why you did that and also if we should opt that back in? If not, I'll just provide the fix for the "static" file. Keep in mind that any change to the regular cartesian axes will need to be mirrored manually to the bar axes if we don't use the code-template for this.
This issue will be closed once the fix is done and merged into master (aka do not close yet), thanks :)
from chartjs.blazor.
Feel free to reopen this issue if you think there's more to do there.
My commits: 9aa52da c718735
from chartjs.blazor.
Related Issues (20)
- Error when rendering BarChart in OnInitializedAsync [TypeError: Cannot read property 'options' of undefined]
- Support to add data with specified x- and y-values? HOT 1
- Customize tooltip with callback function HOT 1
- Can anybody take over development? HOT 1
- Stacked bar charts
- Please migrate Newtonsoft.Json to System.Text.Json, to reduce download szie HOT 1
- Setup min and max for axis
- Has anybody tried to use ChartJs.Blazor.Fork with Net 6.0? HOT 1
- How to drag a point inside a razor page?
- candle
- Mixed Chart Types
- Registering datalabels plugin
- Is it possible to create stacked horizontal bar charts, and if so how can I do it? HOT 1
- How can I draw a vertical line at the selected point on the x-axis?
- Change color font data label
- Radar Chart Example HOT 1
- Datalabel Plugin HOT 1
- Wrong dataset returned when clicking bar in stacked bar chart
- Add support .Net 8 for all render mode
- README typo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chartjs.blazor.