Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1187 - Horizontal shift when show error bars #1409

Open
wants to merge 1 commit into
base: development
Choose a base branch
from

Conversation

sainmas
Copy link

@sainmas sainmas commented Dec 10, 2024

Description

When creating a line bar graph and "Show error bars" is checked, the graph horizontally shrinks.
This request changes a check to allow the use of the x-axis values. Which can be used in a range modifier that affects the size of the x-axis. This range modifier allows error bars to not adjust the size of the graph.

Mason Sain - @sainmas
Pedro Valdovinos Reyes - @PValdovinos

Fixes #1187

Type of change

  • Note merging this changes the database configuration.
  • This change requires a documentation update

Checklist

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

Limitations

One potential issue that remains is the fact that the rangeslider still shows grey area on the right and left.

Copy link
Member

@huss huss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to @sainmas & @PValdovinos for working on this issue. I have made a couple of comments to consider.

Having seem this work, I'm starting to suspect that the Plotly auto range on the x-axis is the issue. I noticed that this solution cuts off the horizontal part of the error bars that are beyond the original range of the data. Thus, Plotly may be shifting the x-axis values to let them show. I'm okay with losing them to stop the shift in points.

I wanted to ask if any other solution was found. OED has, to a certain extent, tried to avoid directly setting ranges and let Plotly do it automatically. However, per my comment above, this may cause the shift. If this is the only option then I'm open to the change.

As for the slider range noted in the limitations, I have a feeling (without testing) that the slider range calculation is not in sync with the new x-axis range value. If it spans more values then it might be gray in the area between. OED has had and still seems to have some issues with the slider range. It might be nice to track this down but you don't have to do this if you don't want to.

@@ -93,7 +92,8 @@ export default function LineChartComponent() {
legend: { x: 0, y: 1.1, orientation: 'h' },
// 'fixedrange' on the yAxis means that dragging is only allowed on the xAxis which we utilize for selecting dateRanges
yaxis: { title: unitLabel, gridcolor: '#ddd', fixedrange: true },
xaxis: { rangeslider: { visible: true }, showgrid: true, gridcolor: '#ddd' }
//Range must be between these values to allow error bars to show properly
xaxis: { rangeslider: { visible: true }, showgrid: true, gridcolor: '#ddd', range: [data[0].x[0], data[0].x[data[0].x.length - 1]]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had an issue where the slider is wrong if there were multiple lines that span different ranges. I think this probably needs to be the min of all first points and the max of all end points to be sure it spans the entire range of all lines.

} else if (!enoughData) {
}
// Checks if there is enough data for at least one valid graph
else if (!data[0].x) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems to have stopped the message about no data in range for the meter. I found this by changing the range outside all points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants