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

Treegraph loses root node at exporting to svg, png and etc. #19552

Closed
artzub opened this issue Aug 14, 2023 · 1 comment · Fixed by #19825
Closed

Treegraph loses root node at exporting to svg, png and etc. #19552

artzub opened this issue Aug 14, 2023 · 1 comment · Fixed by #19825

Comments

@artzub
Copy link

artzub commented Aug 14, 2023

Good day!
Found that we lose root node at exporting to SVG, png if data is updated by both series.setData or series.update.
We have a chart with dynamically adding data here

Expected behaviour

Expect to have a similar tree in the exported png.
image

Actual behaviour

Currently, the chart loses the root node at exporting to SVG or png and we have this result:
image

Live demo with steps to reproduce

https://jsfiddle.net/0d8akt72/9/

Product version

Highcharts: 11.1.0

Workaround

I did some research and found that the chart use series.userOptions.data in getSVG method.
And figured out that the collection series.userOptions.data is broken. Possible, it is related with this bug.
But I made a workaround that fixes exporting:

const getSVG = (H) => {
  H.wrap(H.Chart.prototype, 'getSVG', function (proceed, chartOptions) {
    this.series.forEach((series) => {
      if (series.type !== 'treegraph') {
        return;
      }

      series.userOptions.data = series.data.map((point) => ({
        ...point.options,
      }));
    });
    return proceed.call(this, chartOptions);
  });
};

You can uncomment a line with using the workaround in the above link or use this link

@highsoft-bot highsoft-bot added this to To do in Development-Flow via automation Aug 14, 2023
@karolkolodziej
Copy link
Contributor

Hi @artzub!
Thank you for investigating this and for the workaround it seems very accurate!

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

Successfully merging a pull request may close this issue.

4 participants