Skip to content

- Allow interval charts to compose w/other charts that render-charts() takes #497

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

Merged
merged 4 commits into from
Jan 4, 2024
Merged

- Allow interval charts to compose w/other charts that render-charts() takes #497

merged 4 commits into from
Jan 4, 2024

Conversation

ds26gte
Copy link
Contributor

@ds26gte ds26gte commented Dec 14, 2023

#486

  • chart-lib.js: Have plot() recognize and process interval charts, instead of having separate intervalChart()
  • chart.arr: Rewrite render-charts() to accept interval-chart-series. For this, make interval-chart-series closer in properties to function/line/scatter series. interval-chart-from-list() now must keep track of the largest y's (including offset) so render-charts() can create a better bounding box. render-chart() no longer needs to do anything special with interval-charts, passing them on to render-charts()

  render-charts() takes. #486
- chart-lib.js: Have plot() recognize and process interval charts,
  instead of having separate intervalChart()
- chart.arr: Rewrite render-charts() to accept interval-chart-series.
  For this, make interval-chart-series closer in properties to
  function/line/scatter series. interval-chart-from-list() now must keep
  track of the largest y's (including offset) so render-charts() can
  create a better bounding box. render-chart() no longer needs to do
  anything special with interval-charts, passing them on to
  render-charts()
@schanzer
Copy link

@ds26gte Here's the sample program I'm using to test, which combines a scatter plot and an interval chart:

include chart

xs = [list: 1,-2,9,4]
ys = [list: 1,2,3,4]
fn = lam(x): x end
residuals = map2(
  lam(y, prediction): y - prediction end, 
  ys, 
  map(fn, xs))


scatter = from-list.scatter-plot(xs, ys)
fn-plot = from-list.function-plot(fn)
intervals = from-list.interval-chart(xs, ys, residuals)

render-charts([list: scatter, fn-plot, intervals])
  .display()

With this PR, I get the following error:
image

@jpolitz
Copy link
Member

jpolitz commented Jan 3, 2024

Is this at a point where it should be good to review + go or still in progress?

@schanzer
Copy link

schanzer commented Jan 3, 2024

@jpolitz good to go! Ready for final review and merger

/*
x | n n n | y | n n n n n n n n n n n n
i combined.length - i - 1
*/
Copy link
Member

Choose a reason for hiding this comment

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

This comment was informative about the shape of the data – did the shape change/is the comment irrelevant? Was it wrong/should it be documented somewhere what the new shape is?

});

// console.log('row setting done');
Copy link
Member

Choose a reason for hiding this comment

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

Lots of commented out console.logs – typically our style is to remove these though if there's a good reason for leaving them in because they were difficult to design could leave a comment to that effect.

@jpolitz jpolitz merged commit f9fd790 into brownplt:horizon Jan 4, 2024
@jpolitz
Copy link
Member

jpolitz commented Jan 9, 2024

@ds26gte @schanzer I think for this go ahead and push directly to horizon so you can get the testing and autodeploy. Might make testing cycles faster! I won't release till you say it's ready.

@ds26gte
Copy link
Contributor Author

ds26gte commented Jan 10, 2024

@schanzer brought up a new test case which I'll investigate and then let you know after if it's ready to go.

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