echarts
echarts copied to clipboard
Y-axis, type:'log' , series type :'bar', the first data value is 0, the bars on charts is not normal.
option = {
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'log'
},
series: [{
data: [0, 200, 150, 80, 70, 110, 130],
type: 'bar'
}]
};
log(0)
is -Infinity
. So after removing 0
it will be OK.
But it is needed to be think whether to trade 0
as an empty data.
Yes,removing 0
it will be OK.
Based the series type is 'bar', normally, data 0
should be accepted. and the bar length should be zero.
As you said, if Echarts trade 0
as an empty data when Y-axis type is 'log' should be a good practices.
IMHO: also negative numbers (and 0) should be treated as empty
Hi @100pah Is there any update on this issue? It is essential in most enterprise applications to allow users to switch between log scale and linear scale, and zero/negative values should be treated as empty in those cases.
@100p @pavish It might not be ideal, but I've switch the data to null
when the value is zero/negative and switch it back to its original value when using the linear scale.
@100p @pavish It might not be ideal, but I've switch the data to
null
when the value is zero/negative and switch it back to its original value when using the linear scale.
@jonavila I guess I can use that for now, until the issue is fixed. Thanks!
@jonavila I have found a better workaround for the moment. While changing linear axis to log axis just change min value config option to 1.
eg.,
yAxis: { type: 'log', min: 1 }
Although, if your values are lesser than 1, just set the min value to the least value in your data.
@100pah any updates on this?
Years later and still not fixed? If you have one zero data point in your series you can't really use log axis currently....
@100pah is possible to replace all 0
to null
by dataset transform ?
trade 0 as an empty data
should be as simple as possible
hello guyz, any update on this ? my data are dynamic and i cant replace the 0 with null or empty data because it's a big difference in my case , (0 means no traffic and null means i fetched no data at this time), please if someone has a fix let me know
in my case , (0 means no traffic and null means i fetched no data at this time), please if someone has a fix let me know
workaround - replace 0 with '' (empty string) and keep the nulls too.
This issue seems to be related to data preparation, not a ECharts bug. Label priority-high is a kind of a overkill.
This issue seems to be related to data preparation, not a ECharts bug. Label priority-high is a kind of a overkill.
I disagree. 0
is a valid integer which should not cause a charting library to break.
hello guyz, any update on this ? my data are dynamic and i cant replace the 0 with null or empty data because it's a big difference in my case , (0 means no traffic and null means i fetched no data at this time), please if someone has a fix let me know
the same here, 0 and null should be treated separately :(
any updates!!
I solved using NaN
instead of 0