tweak example.
1 file changed
tree: a4fc8db4362a9c7af6ec46c44cbab96142c89c15
  1. .babelrc
  2. .eslintrc.yaml
  3. .gitignore
  4. README.md
  5. _config.yml
  6. build/
  7. config/
  8. package-lock.json
  9. package.json
  10. public/
  11. src/
  12. tool/
README.md

Examples of ECharts

Install

npm install

Dev

npm run dev

Release

npm run release

It will copy all the build resources to incubator-echarts-website/next/examples

Use local echarts build

  1. Update the URL of localEChartsMinJS in common/config.js
  2. Add local=1 in URL. For example: editor.html?c=area-basic&local=1

Update example snapshots

node tool/build-example.js

Only for default theme

node tool/build-example.js -t default

Edit example

All test cases are in the public/data folder. The comment in the header

/*
title: Area Pieces
titleCN: 折线图区域高亮
category: 'line, visualMap'
*/

describes the meta info of this example.

Some built-in features available in examples

Import third-party library

For example:

$.when(
    $.getScript(ROOT_PATH + '/data/asset/js/myTransform.js'),
    $.getScript('https://cdn.jsdelivr.net/npm/d3-contour@2.0.0/dist/d3-contour.jXs'),
).done(function () {
    // ...
});

Controller panel

Use this code to enable controller panel for a example:

app.config = {
    aNameForTheSelectWidget: 'This is the initial value'
    aNameForTheRangeWidget: 45,
    aNameForTheButtonWidget: function () {
        // Do something.
    },
    onChange: function () {
        // Do something.
    }
};
app.configParameters = {
    aNameForTheSelectWidget: {
        options: [
            'This is the initial value',
            'This is another value',
            'This is the third value'
        ]
    },
    aNameForTheRangeWidget: {
        min: -90,
        max: 90
    }
};

Resize

app.onresize = function () {
    // Do something.
}

Get width and height of the chart area

var width = myChart.getWidth();
var height = myChart.getHeight();