Giter Site home page Giter Site logo

cybyob / echarts-examples Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apache/echarts-examples

0.0 0.0 0.0 628.12 MB

Examples of Apache ECharts

Home Page: https://echarts.apache.org/examples

License: Apache License 2.0

JavaScript 42.62% TypeScript 51.43% CSS 0.05% HTML 1.28% Vue 4.01% SCSS 0.61%

echarts-examples's Introduction

Examples of ECharts

Install

npm install

Edit examples

How

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

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

describes the meta info of this example.

If you want to record a video to show the animation when genering screenshot. Use videoStart and videoEnd:

/*
title: Bar Race
titleCN: 动态排序柱状图
category: bar
difficulty: 5
videoStart: 1000
videoEnd: 6000
*/

Most of examples are written in TypeScript. You need to compile it to JavaScript by using command:

npm run compile:example

Some built-in features available in examples

Import third-party library

For example:

$.when(
  $.getScript(ROOT_PATH + '/data/asset/js/xxxx.js'),
  $.getScript(
    'https://cdn.jsdelivr.net/npm/[email protected]/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();

View and edit echarts-examples website

Dev and view examples in website

npm run dev

Use local echarts build

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

Run e2e tests.

Run all the examples to test package publishing and install, module importing, minimal bundling and DTS correctness.

Before run the tests. you need to update the examples list.

npm run build:examplelist

If puppeteer has not been installed:

npm i puppeteer

If you want to save the log:

exe_something > 1.log 2>&1

Run e2e test using local dependent repos

If you are testing a new version of echarts or zrender, which are not released in github yet, you need run e2e test with local dependent repos.

Firstly, make sure the dependent repos listed in dir attributes in echarts-examples/e2e/config.js existing and having release built.

Note: the commands below will execute npm install in these local directories.

# run e2e using local dependent repos and webpack.
npm run test:e2e:local > result.log 2>&1
# run e2e using local dependent repos and esbuild, which is much faster.
npm run test:e2e:esbuild:local > result.log 2>&1

Run e2e test using remote dependent repos

Note: the commands below will download the repos listed in echarts-examples/e2e/config.js to a temporary folder.

# run e2e using remote dependent repos and webpack.
npm run test:e2e > result.log 2>&1
# run e2e using remote dependent repos and esbuild, which is much faster.
npm run test:e2e:esbuild > result.log 2>&1

Check the test result

The test result is in:

  • the result.log
  • echarts-examples/e2e/report.html, the file should be opened in your own local http server.

Run partial tests.

Note: This can only be used when you run the whole e2e test at least once.

Skip specific stages.

node e2e/main.js --skip bundle

Specify matched tests.

node e2e/main.js --skip npm --tests bar3D*

Release

  1. Update example snapshots
npm run build:example

# Node: If only build for default theme:
node tool/build-example.js -t default
  1. Build and copy all the build resources to echarts-website
npm run release

# Note: the config of the dir of echarts-website is in
# `echarts-examples/config/**`

echarts-examples's People

Contributors

100pah avatar corey-wang avatar cybyob avatar dependabot[bot] avatar deqingli avatar fuchunhui avatar gumichocopengin8 avatar guoyunhe avatar hartraft avatar huangyulie avatar jsdelivrbot avatar lauwen avatar lorenzoxue avatar muoi avatar ovilia avatar pissang avatar plainheart avatar sadortun avatar striezel avatar tomsoftware avatar vojty avatar wdingding avatar xhong0 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.