Skip to content

Commit

Permalink
Merge pull request apache#4 from terrestris/update-readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
jansule authored Jan 5, 2023
2 parents d352063 + edcd600 commit 666b90a
Showing 1 changed file with 46 additions and 35 deletions.
81 changes: 46 additions & 35 deletions superset-frontend/plugins/plugin-chart-cartodiagram/README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,61 @@
# plugin-chart-cartodiagram
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
An OpenLayers map that displays charts for single features. Superset Chart Plugin.
http://www.apache.org/licenses/LICENSE-2.0
## Usage
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

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

0 comments on commit 666b90a

Please sign in to comment.