question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Determine Bar-Width based on time-axis

See original GitHub issue

What 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:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
LarsKoelpincommented, Mar 6, 2020

@LarsKoelpin Can you post a snippet of the custom chart option you used?

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

0reactions
github-actions[bot]commented, Mar 13, 2022

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found