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

[Goal] Full circle is cut off when container is resized #1598

Closed
Tracked by #124925
Kuznietsov opened this issue Feb 17, 2022 · 8 comments · Fixed by #1620
Closed
Tracked by #124925

[Goal] Full circle is cut off when container is resized #1598

Kuznietsov opened this issue Feb 17, 2022 · 8 comments · Fixed by #1620
Assignees
Labels
bug Something isn't working :goal/gauge (old) Old Goal/Gauge chart related issues kibana cross issue Has a Kibana issue counterpart

Comments

@Kuznietsov
Copy link

Kuznietsov commented Feb 17, 2022

Problem description

While trying to replace the vislib gauge with the goal from the elastic-charts, it has been found the further issue.

If the full circle has been drawn and its container has been resized, the bottom of the circle is cut off and a lot of space on the top is left.

Circle angle configuration

const angleStart = Math.PI / 2;
const angleEnd = -(Math.PI + Math.PI / 2);

Current behavior

circle.cut.mov

Expected behavior

After the resizing, the circle should be in the middle of the container and should be resized according to the new size of the container.


Version:

  • Elastic Charts: 43.1.1

Kibana Cross Issues:

@Kuznietsov Kuznietsov added the bug Something isn't working label Feb 17, 2022
@stratoula stratoula added :goal/gauge (old) Old Goal/Gauge chart related issues kibana cross issue Has a Kibana issue counterpart labels Feb 21, 2022
@markov00
Copy link
Member

markov00 commented Feb 21, 2022

@Kunzetsov this is actually strange and looks like not an issue with the elastic-charts, but with the style of the container.
I've tried locally in our storybook, and the parent can be reduced to a very small size keeping the chart within its center
Screenshot 2022-02-21 at 15 41 35

Taking a look at your image and recording it looks like the chart has been pushed down a bit from the center of the rendering panel: see the alignment here for example
Screenshot 2022-02-21 at 15 44 35

Please can you double check the CSS style of the chart and make sure the parent doesn't have any padding/marging/flexing for its children?

@Kuznietsov
Copy link
Author

Screenshot 2022-02-21 at 16 56 59

export const Example = () => (
  <Chart>
    <Settings baseTheme={useBaseTheme()} />
    <Goal
      id="spec_1"
      subtype={subtype}
      base={0}
      target={260}
      actual={280}
      bands={[200, 250, 300]}
      ticks={[0, 50, 100, 150, 200, 250, 265, 280]}
      tickValueFormatter={({ value }: BandFillColorAccessorInput) => String(value)}
      bandFillColor={({ value }: BandFillColorAccessorInput) => bandFillColor(value)}
      labelMajor=""
      labelMinor=""
      centralMajor="280 MB/s"
      centralMinor=""
      angleStart={Math.PI / 2}
      angleEnd={-(Math.PI + Math.PI / 2)}
    />
  </Chart>
);

@markov00
Copy link
Member

it looks strage (with a padding on the top), can you please check this link https://elastic.github.io/elastic-charts/?path=/story/goal-alpha--full-circle&globals=theme:light

@Kuznietsov
Copy link
Author

@Kuznietsov
Copy link
Author

Kuznietsov commented Feb 21, 2022

@markov00, here is a difference:

your example:

      angleStart={Math.PI + Math.PI / 2}
      angleEnd={-Math.PI / 2}

my example:

      angleStart={Math.PI / 2}
      angleEnd={-(Math.PI + Math.PI / 2)}

Your example is working perfectly, but I need the indicator of value to start from the top point of the circle.

@markov00
Copy link
Member

oh that's interesting thanks, I will take a look and see what is going on there

@Kuznietsov
Copy link
Author

@markov00, thanks a lot)

@markov00
Copy link
Member

the issue is caused by a wrong calculation of the saggitta introduced here: #1413
@nickofthyme can you please take a look and see why those different angles are not working nicely?

@nickofthyme nickofthyme self-assigned this Feb 22, 2022
@nickofthyme nickofthyme added this to the Kibana 8.2 milestone Mar 16, 2022
@nickofthyme nickofthyme changed the title [Goal] Full circle is cut off when container is resized [Goal] Full circle is cut off when container is resized th Mar 16, 2022
@nickofthyme nickofthyme changed the title [Goal] Full circle is cut off when container is resized th [Goal] Full circle is cut off when container is resized Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working :goal/gauge (old) Old Goal/Gauge chart related issues kibana cross issue Has a Kibana issue counterpart
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants