charts
charts copied to clipboard
Y axis: define low and high point of data
Hello guys! I hope you're all well, I have an issue with the line chart. Is there a way to define the Y axis lower value to 0, even thought the values entered are all in "100"?And is there a way to define the Y axis higher value to 100 aswell? How can I do that?
by the way, thank you for making this library, I love it! Is there more documentation?
Thanks in advance,
Myr
*
the datasets
datasets: [
{
title: "Finiquito", color: "green",
values: [100, 100, 100, 100, 100, 100]
}
]
Here comes the whole code:
let linedatatest = {
labels: ["May", "Jun", "Jul", "Aug", "Sep", "Oct"],
datasets: [
{
title: "Finiquito", color: "green",
values: [0, 100, 100, 100, 100, 100]
}
]
};
let linecharttest = new Chart({
parent: "#linedatatest", // or a DOM element
title: "Linedata",
data: linedatatest,
type: 'line', // or 'line', 'scatter', 'pie', 'percentage'
width: 720,
height: 230,
format_tooltip_x: d => (d + '').toUpperCase(),
format_tooltip_y: d => d + ' pts'
});
FrappΓ© Charts version: https://unpkg.com/[email protected]/dist/frappe-charts.min.iife.js
I would love to know too. Can't find any documentation on this.
My workaround is to put an empty y-marker.
let linedatatest = {
labels: ["May", "Jun", "Jul", "Aug", "Sep", "Oct"],
datasets: [
{
title: "Finiquito", color: "green",
values: [0, 100, 100, 100, 100, 100]
}
],
yMarkers: [
{
label: '',
value: 0,
type: 'solid'
}
]
};
It works for me.
Being able to set the minimum
, maximum
and increment
values for the Y axis would be very helpful. I think it would help solve this issue as well as #100 and #127.
This is definitively a needed feature. Is this something that will be implemented in the future?
Hey if there is any guidance on how someone might approach this I might take a crack at it at some point π I just ran across this issue myself where I don't want to have any increment less that a whole number (and also I want the minimum to always be at 0)
I think #264 can be closed as a duplicate of this issue.
@mansona Did you try the workaround in https://github.com/frappe/charts/issues/86#issuecomment-375557382?
so It's been so long for me that I'm not sure which issue is referring to what any more π @mathiasbynens I looked at my code and it does seem to make sure that all graphs have a 0 in them if that's what you're hoping the workaround does
In my case I would love a way to properly influence the Y axis and make it not show 0.25
entries when my graph has a high number of 1 π
In fact I just solved my problem with an even worse workaround π I now have 2 yMarkers:
yMarkers: [
{
label: '',
value: 0,
type: 'solid'
},
{
label: '',
value: 5,
type: 'solid'
}
]
and that will prevent partial numbers from showing in the graph. And since I really don't have a need for numbers I'm just ignoring them always with CSS:
.frappe-chart .y-markers {
display: none;
}
It's not a great solution, and you can't use it if you ever want to actually use markers but π€·