Skip to content

fix: always get points so state last works with other graphs#1075

Open
jasonlewis wants to merge 1 commit into
kalkih:devfrom
jasonlewis:fix/state-last
Open

fix: always get points so state last works with other graphs#1075
jasonlewis wants to merge 1 commit into
kalkih:devfrom
jasonlewis:fix/state-last

Conversation

@jasonlewis
Copy link
Copy Markdown

Fixes #736 by always getting points.

There's probably a few ways to fix this as it seems the state: last functionality specifically relies on points being available, but points are only set when specifically showing points (and never for bar graphs).

I decided to always define points and adjust the logic for rendering points to be based on whether the config is set. Granted I haven't tested all scenarios for rendering points so this may not be an adequete solution in all cases.

Comment thread src/main.js
@akloeckner
Copy link
Copy Markdown
Collaborator

@jasonlewis, thanks for contributing! It seems we'll have to work on it a bit still. See my comment. Unfortunately, I will only be able to look into it in a few days...

@akloeckner
Copy link
Copy Markdown
Collaborator

I did think about this quite some time. Sorry for the delay.

Although it's a small change, I don't like that we would treat points differently from the other properties, such as bar. So, I wondered, could we make this more consistent and came up with two ideas:

  1. What do you think about always defining all those properties and moving the conditions to the render* functions? I'm a bit hesitant, because I still don't fully understand, how much calculating this would cause.

  2. One other thing, I just stumbled against is: we could maybe just use this.Graph[id].coords[-1][V] instead of this.points[id][-1][V]. Or would we abuse the Graph then?

What do you think? Maybe you discarded these ideas already for some reason?

@Liquidmasl
Copy link
Copy Markdown

I did think about this quite some time. Sorry for the delay.

Although it's a small change, I don't like that we would treat points differently from the other properties, such as bar. So, I wondered, could we make this more consistent and came up with two ideas:

  1. What do you think about always defining all those properties and moving the conditions to the render* functions? I'm a bit hesitant, because I still don't fully understand, how much calculating this would cause.
  2. One other thing, I just stumbled against is: we could maybe just use this.Graph[id].coords[-1][V] instead of this.points[id][-1][V]. Or would we abuse the Graph then?

What do you think? Maybe you discarded these ideas already for some reason?

Your concern is valid, its a bit smelly to use a graph construct as data retrieval, but dont let a little smell stand in the way of a decent fix. This bug is real and the proposed fix works, and is just slightly smelly.
Your second approach is probably cleaner, get the raw data with this.Graph[id].coords[last][V].

But this bug could have been fixed 2 years ago. A follow up issue could have been opened to refactor this so it doesnt fall through if the time for refactors arises.

So my suggestion; merge this, make a follow up issue for a refactor. Get it fixed today, its waiting 2 years already for a minor smell.

@Liquidmasl
Copy link
Copy Markdown

Liquidmasl commented Apr 11, 2026

yeah well nvm, just close this PR in the favor or this one #1308 and get it merged.

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.

3 participants