Determine Bar-Width based on time-axis
See original GitHub issueWhat problem does this feature solve?
The current barSeries is centered around its point in time. But, to present time-based data, it is often necessary to present a bar based on a given time-window.
Currently, it is possible to determine the width of the bar in pixels but not relative to the corresponding x-value when using time-axis. For my specific usecase i need to draw a bar chart representing a timewindow. e.g. the bar shall span from 1pm to 2pm instead of centering a fixed pixelwidth around 1:30pm.
What does the proposed API look like?
My Proposal would be the be able to specify a function, “relativeBarWith”, which gets the current x value as parameter
{
type: "bar",
relativeBarWidth: (timestamp) => ({
startBarAt: timestamp - MS_ONE_HOUR,
endBarAt: timestamp
})
}
echarts would then dynamically calculate the width in pixels of the bar.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
D3.js: calculate width of bars in time scale with changing range?
There's no function to get the width, but you can calculate it quite easily: .attr("width", width/data.length);.
Read more >Perspective 8.0.14 Time Series Bar Chart width - Ignition
There isn't a setting for bar width. The width is calculated automatically based on the number of data points being displayed on the...
Read more >width - Sets the Chart Width | CanvasJS JavaScript Charts
width property sets the Chart Width to any given value in Pixels. Takes the Chart container width by default.
Read more >Bar chart on interval axis - Graphically Speaking - SAS Blogs
This creates the above graph, where the X axis is displayed as a scaled time axis, and each treatment is displayed side-by-side. The...
Read more >3.6 Adjusting Bar Width and Spacing - R Graphics Cookbook
3.6.2 Solution. To make the bars narrower or wider, set width in geom_col() . The default value is 0.9; larger values make the...
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
Sure, its the one derivation used in my reproduction case of #12221 (https://jsfiddle.net/3zrLnvqp/). The code may to off tho, as the “lowerLeft” is actually topLeft I think. Also, as the issue suggests, you have to turn off progressive rendering
This issue has been automatically closed because it did not have recent activity. If this remains to be a problem with the latest version of Apache ECharts, please open a new issue and link this to it. Thanks!