From edcd6006a27f08b2597175cd7ddfc78620ad9fdc Mon Sep 17 00:00:00 2001 From: jansule Date: Wed, 4 Jan 2023 15:56:43 +0100 Subject: [PATCH] bfs: update plugin readme --- .../plugin-chart-cartodiagram/README.md | 81 +++++++++++-------- 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-cartodiagram/README.md b/superset-frontend/plugins/plugin-chart-cartodiagram/README.md index b128142225fd8..cf91648c57b60 100644 --- a/superset-frontend/plugins/plugin-chart-cartodiagram/README.md +++ b/superset-frontend/plugins/plugin-chart-cartodiagram/README.md @@ -1,50 +1,61 @@ -# plugin-chart-cartodiagram + -To build the plugin, run the following commands: +## @superset-ui/plugin-chart-cartodiagram -``` -npm ci -npm run build -``` +[![Version](https://img.shields.io/npm/v/@superset-ui/plugin-chart-cartodiagram.svg?style=flat-square)](https://www.npmjs.com/package/@superset-ui/plugin-chart-cartodiagram) -Alternatively, to run the plugin in development mode (=rebuilding whenever changes are made), start the dev server with the following command: +This plugin provides ECharts viz on an OpenLayers map for Superset: -``` -npm run dev -``` +- Timeseries Chart (combined line, area bar, scatter, smooth, step) +- Pie Chart -To add the package to Superset, go to the `superset-frontend` subdirectory in your Superset source folder (assuming both the `superset-ol-plugin` plugin and `superset` repos are in the same root directory) and run -``` -npm i -S ../../superset-ol-plugin -``` +### Usage -After this edit the `superset-frontend/src/visualizations/presets/MainPreset.js` and make the following changes: +Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to +lookup this chart throughout the app. ```js -import { SupersetOlPlugin } from 'superset-ol-plugin'; -``` +import { + CartodiagramPlugin, +} from '@superset-ui/plugin-chart-cartodiagram'; -to import the plugin and later add the following to the array that's passed to the `plugins` property: -```js -new SupersetOlPlugin().configure({ key: 'superset-ol-plugin' }), +new CartodiagramPlugin().configure({ key: 'cartodiagram' }).register(); ``` -After that the plugin should show up when you run Superset, e.g. the development server: +Default layers can be added to the constructor. These layers will be added to each chart by default. See also `./src/types.ts` for the definitions of types `WmsLayerConf`, `WfsLayerConf` and `XyzLayerConf`. +```js +import { + CartodiagramPlugin, +} from '@superset-ui/plugin-chart-cartodiagram'; + +const opts = { + defaultLayers: [ + { + type: 'XYZ', + url: 'example.com/path/to/xyz/layer', + title: 'my default layer title', + attribution: 'my default layer attribution', + }, + ], +}; + +new CartodiagramPlugin(opts).configure({ key: 'cartodiagram' }).register(); ``` -npm run dev-server -``` - -## Releases - -Releases will be created and published automatically. - -In order to publish a proper release, follow these steps: - -1. Run `npm version patch|minor|major -m "Version %s"` -2. Run `git push origin master && git push --tags` -3. Watch pipeline doing its job