1.1.27 • Published 11 days ago

@rainbow-d9/echarts v1.1.27

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

Static Badge

License GitHub Release GitHub Release Date GitHub last commit (by committer)

npm (scoped) npm

Depends Depends Depends

Module Formats

d9-echarts

Echarts.

Basic Chart

Attribute NameTypeDescription
initOptionsChartInitOptions \| (() => Promise<ChartInitOptions>)echarts init options.
optionsEChartsOption \| (() => EChartsOption)echarts options, could include data.
settingsSetOptionOpts \| (() => SetOptionOpts)echarts settings.
markertextChart marker, global unique.
mergeData(options: EChartsOption, data: any) => Promise<EChartsOption>merge data to options.
loading() => object \| [string, object]echarts loading options.
heightnumber, textChart height, default 300px.

Basic Chart refreshes the chart by receiving external events ChartGlobalEventPrefix.DATA_CHANGED. Before sending events to Basic Chart, please ensure that the data required by the chart has been written to the model. Basic Chart obtains data through the defined model properties and calls mergeData to merge the data into echarts options, and then refreshes the chart.

A Sample

- Chart::Use Canvas, Default::first
	- $fc
	- options:
	  ```javascript
	  return {
	    xAxis: {type: 'category', data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']},
	    yAxis: {type: 'value'},
	    series: [{type: 'bar'}]
	  }
	  ```
	- merge:
	  ```javascript
	  options.series[0].data = data;
	  return options;
	  ```

Chart will not respond reaction repaint, to notify chart repaint, fire value changed event by root event bus.

Autonomous Chart

On top of Basic Chart, the following properties are added:

Attribute NameTypeDescription
fetchData(options: FetchDataOptions) => Promise<any>fetch chart data.
fetchIntervalnumber10 seconds default.

Autonomous Chart fetches data through fetchData, making it self-refreshing.

A Sample

- AutChart::Refresh every 1 second::second
	- $fc
	- options:
	  ```javascript
	  return {
	    legend: {top: 'bottom'},
	    series: [
	      {
	        name: 'Nightingale Chart', type: 'pie', radius: ['20%', '60%'], center: ['50%', '50%'], roseType: 'area',
	        itemStyle: { borderRadius: 8 }
	      }
	    ]
	  }
	  ```
	- merge:
	  ```javascript
	  options.series[0].data = data;
	  return options;
	  ```
	- fetch:
	  ```typescript
	  return ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map(name => {
	    return { value: Math.ceil(Math.random() * 30) + 20, name };
	  });
	  ```
	- interval: 1

Reliant Chart

On top of Basic Chart, the following properties are added:

Attribute NameTypeDescription
fetchData(options: FetchDataOptions) => Promise<any>fetch chart data.
fetchDefernumber1 seconds default.

Reliant Chart fetches data through fetchData. It depends on the data of other widgets, when the data of other widgets changes, it will be refreshed after deferred time.
In order for the chart to listen for data changes from other widgets, a reaction needs to be defined. The markdown configuration has already added the criteria property to define this type of response, so you only need to add the properties that need to be listened to.

A Sample

- Dropdown::Month::third.criteria.weekOfYear
	- options: 1:Jan; 2:Feb; 3:Mar; 4:Apr; 5:May; 6:Jun; 7:Jul; 8:Aug; 9:Sep; 10:Oct; 11:Nov; 12:Dec
	- place: $row: 1, $col: 1, $cols: 3
- Dropdown::Gender::third.criteria.gender
	- options: F:Female;M:Male
	- place: $row: 2, $col: 1, $cols: 3
- RelChart::::third.data
	- place: $row: 1, $rows: 2, $col: 4, $cols: 3
	- options:
	  ```javascript
	  return {
	    legend: {top: 'bottom'},
	    series: [
	      {
	        name: 'Nightingale Chart', type: 'pie', radius: ['20%', '60%'], center: ['50%', '50%'], roseType: 'area',
	        itemStyle: { borderRadius: 8 }
	      }
	    ]
	  }
	  ```
	- merge:
	  ```javascript
	  options.series[0].data = data;
	  return options;
	  ```
	- fetch:
	  ```typescript
	  return ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'].map(name => {
	    return { value: Math.ceil(Math.random() * 30) + 20, name };
	  });
	  ```
	- criteria:
		- on: /third.criteria.**
1.1.27

11 days ago

1.1.26

15 days ago

1.1.25

20 days ago

1.1.24

20 days ago

1.1.23

25 days ago

1.1.22

25 days ago

1.1.21

25 days ago

1.1.20

26 days ago

1.1.19

27 days ago

1.1.18

1 month ago

1.1.17

1 month ago

1.1.16

1 month ago

1.1.15

1 month ago

1.1.12

1 month ago

1.1.14

1 month ago

1.1.13

1 month ago

1.1.11

1 month ago

1.1.9

1 month ago

1.1.10

1 month ago

1.1.10-alpha.1

1 month ago

1.1.10-alpha.2

1 month ago

1.1.8

2 months ago

1.1.7

2 months ago

1.1.6

2 months ago

1.1.5

2 months ago

1.1.4

2 months ago

1.1.3

2 months ago

1.1.2

2 months ago

1.1.1

2 months ago

1.1.0

2 months ago

1.0.58

2 months ago

1.0.57

2 months ago

1.0.56-alpha.1

3 months ago

1.0.56

3 months ago

1.0.55

3 months ago

1.0.54

3 months ago

1.0.53

3 months ago

1.0.52

3 months ago

1.0.51

3 months ago

1.0.50

4 months ago

1.0.49

4 months ago

1.0.48

4 months ago

1.0.47

4 months ago

1.0.46

4 months ago

1.0.44

4 months ago

1.0.45

4 months ago

1.0.43

4 months ago

1.0.39

4 months ago

1.0.40

4 months ago

1.0.42

4 months ago

1.0.41

4 months ago

1.0.38

4 months ago

1.0.37

4 months ago