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

MarkDimension not working as expected. Someone an idea? Is this a bug? #53

Closed
dasdom opened this issue Jun 16, 2022 · 3 comments
Closed

Comments

@dasdom
Copy link

dasdom commented Jun 16, 2022

I tried to add the bottom right chart to the repo but there seems to be bugs in the beta 1.

Reading the documentation of MarkDimension, I assume that using .inset(0) should fill the step size. If I understand it correctly this should result in rectangles next to each other filling the whole space, as desired.
Screenshot 2022-06-16 at 22 40 48

But when I create a chart like this:

Chart(data) { rectData in
  RectangleMark(x: .value("x", rectData.a),
                y: .value("y", rectData.b),
                width: .inset(0),
                height: .inset(0))
  .foregroundStyle(by: .value("Value", rectData.value))
}

the result is an empty chart:

Screenshot 2022-06-16 at 22 46 12

I get it to work with the following code (works but uses hard-coded values for the step size):

Chart(data) { rectData in
  RectangleMark(xStart: .value("minA", rectData.a),
                xEnd: .value("maxA", rectData.a + 1),
                yStart: .value("minB", rectData.b),
                yEnd: .value("minB", rectData.b + 1.0))
    .foregroundStyle(by: .value("Value", rectData.value))
}

The result:

Screenshot 2022-06-16 at 22 48 29

Do I misunderstand .inset(_:)?

By the way, .ratio(1) doesn't work as well.

@atrinh0
Copy link
Collaborator

atrinh0 commented Jun 16, 2022

Does HeatMap cover this chart type?

@dasdom
Copy link
Author

dasdom commented Jun 16, 2022

Oh, haven't seen this.
HeatMap uses the same solution I used in my working example. It's ok but not ideal in my opinion because of the hard coded step size.

I'll close this issue. Thanks.

@dasdom dasdom closed this as completed Jun 16, 2022
@atrinh0
Copy link
Collaborator

atrinh0 commented Jun 16, 2022

Keep in mind the HeatMap code is one potential way to represent the chart. No idea if that is the way the chart was intended to be used. Happy to see any other solutions anyone can work out and would always welcome the addition for everyone to learn from.

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

No branches or pull requests

2 participants