dynamic bar with sorting process negative value as postive
See original GitHub issueVersion
5.2.2
Steps to reproduce
https://echarts.apache.org/examples/zh/editor.html?c=bar-race
const data = [];
for (let i = 0; i < 5; ++i) {
data.push(Math.round(Math.random() * 200));
}
option = {
xAxis: {
max: 'dataMax'
},
yAxis: {
type: 'category',
data: ['A', 'B', 'C', 'D', 'E'],
inverse: true,
animationDuration: 300,
animationDurationUpdate: 300,
max: 2 // only the largest 3 bars will be displayed
},
series: [
{
realtimeSort: true,
name: 'X',
type: 'bar',
data: data,
label: {
show: true,
position: 'right',
valueAnimation: true
}
}
],
legend: {
show: true
},
animationDuration: 0,
animationDurationUpdate: 3000,
animationEasing: 'linear',
animationEasingUpdate: 'linear'
};
function run() {
for (var i = 0; i < data.length; ++i) {
if (Math.random() > 0.9) {
data[i] = Math.round(Math.random() * 1000 -500);
} else {
data[i] = Math.round(Math.random() * 200-140);
}
}
myChart.setOption({
series: [
{
type: 'bar',
data
}
]
});
}
setTimeout(function () {
run();
}, 0);
setInterval(function () {
run();
}, 3000);
What is expected?
negative will not great than postive
What is actually happening?
echarts use abs() value to compare
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8 (1 by maintainers)
Top Results From Across the Web
How to separate colors for positive and negative bars in ...
In Excel, when we create a chart with both positive numbers and negative numbers, all the series data bars are the same color...
Read more >Matplotlib - Updating bar graph with positive and negative ...
I am using the method described in this answer to dynamically update a bar graph. The bar graph I want however should show...
Read more >Diverging Bar Chart using Python - GeeksforGeeks
Diverging Bar Charts are used to ease the comparison of multiple groups. Its design allows us to compare numerical values in various groups....
Read more >Create a Dynamic Diverging Stacked Bar Chart in Power BI ...
This measure will handle both the positive (selected) category while also dynamically handling negative (non-selected) values.
Read more >Bar Chart with Positive and Negatives but Sort by Absolute.
We have bar chart with positive and negatives showing. Fairly simple but they want it sorting by absolute. I attached a picture of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you can change source code by
patch-package
to support negative values detail like this, but i’m not sure if it will bring new problemsstep 1, change this part, use value instand of barHeight,it’s the reason why not support negative.
setp 2, add some handle for extreme case
step 3, complete the remainder part
建议你使用 gif 格式的图片(而不是视频)重现视效,推荐使用类似 ScreenToGif 之类的录屏工具。