Hi Larry,

The source code is available at the repo `echarts-examples`. [1]

There are two ways to generate the URL that can be recognized by the
ECharts editor:

1) Encode the source code with Base64 and pass a parameter `enc=base64`.
This is the simplest way but not beneficial for reducing the URL length.

2) Use the `lz-string` library [2] to compress the source code to a Base64
string.
This is the most often used to generate the sharable URL by the ECharts
editor. You can refer to [3] for the compression function.

[1] https://github.com/apache/echarts-examples/tree/gh-pages/src/editor
[2] https://github.com/pieroxy/lz-string
[3]
https://github.com/apache/echarts-examples/blob/gh-pages/src/common/helper.js#L95-L103


On Wed, Dec 6, 2023 at 2:18 AM helgasoft <helgas...@gmail.com> wrote:

> Hello Developers,
>
> My question is related to the Editor webpage
> <https://echarts.apache.org/examples/en/editor.html>. It has a
> magnificent Share button which compresses source code into a URL. I
> looked at the page source and found "getSharableURL", but the code is
> minified and hard to read.
> Is there a chance to get the actual source code from you?
> The reason is - I have an ECharts add-on GitHub library
> <https://github.com/helgasoft/echarty>. There is already a function to
> export ECharts source code. I would like to add a compressor to provide
> a final URL for your Editor, avoiding copy/paste.
>
> Using ECharts everyday and loving it!
> Larry
>

Reply via email to