Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Download chart with legend #192

Merged
merged 14 commits into from
Nov 13, 2018

Conversation

gky360
Copy link
Contributor

@gky360 gky360 commented Oct 15, 2018

This PR aims to enable users to download chart (including legend) as an image file.

The image file is generated at frontend as follows.

  1. Create a temporary invisible DOM node, which includes a chart (including legend) for download
  2. Write the DOM node to canvas ( html2canvas )
  3. Convert the canvas to data URL
  4. Download file from the data URL
  5. Delete the DOM node

Generated png image is like:

example_results_20181112215917

@gky360 gky360 requested review from ofk and makky3939 October 15, 2018 07:25
@disktnk disktnk added this to the v0.7.0 milestone Oct 15, 2018
@@ -1,10 +1,9 @@
import path from 'path';
import saveSvgAsPng from 'save-svg-as-png';
Copy link
Member

Choose a reason for hiding this comment

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

If you stop to use save-svg-as-png, you should run npm un save-svg-as-png.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you. I executed npm un save-svg-as-png .

downloadFile(fileName, dataURL);
};

export const downloadChartAsPng = async (chartDOMNode, exportName) => {
Copy link
Member

Choose a reason for hiding this comment

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

Is aysnc & await available? I don't know that @babel/env supports it. There is no problem if possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I confirmed babel transpiles async/await correctly with current config.

@disktnk
Copy link
Member

disktnk commented Nov 6, 2018

please merge #204 to fix CIs error

@gky360 gky360 changed the title [WIP] Download chart with legend Download chart with legend Nov 12, 2018
@ofk
Copy link
Member

ofk commented Nov 13, 2018

LGTM!

@ofk ofk merged commit 0851fd3 into chainer:master Nov 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants