-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b7cec5
commit ad74e60
Showing
53 changed files
with
2,665 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
...kages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-calendar/Stories.tsx
This file was deleted.
Oops, something went wrong.
100 changes: 0 additions & 100 deletions
100
.../packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-calendar/data.js
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
...packages/superset-ui-plugins-demo/storybook/stories/legacy-plugin-chart-calendar/index.js
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
...i/superset-ui-plugins-deckgl/packages/superset-ui-preset-chart-deckgl/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## @superset-ui/legacy-preset-chart-nvd3 | ||
|
||
[![Version](https://img.shields.io/npm/v/@superset-ui/legacy-preset-chart-nvd3.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/legacy-preset-chart-nvd3.svg?style=flat-square) | ||
[![David (path)](https://img.shields.io/david/apache-superset/superset-ui-plugins.svg?path=packages%2Fsuperset-ui-legacy-preset-chart-nvd3&style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins?path=packages/superset-ui-legacy-preset-chart-nvd3) | ||
|
||
This plugin provides Big Number for Superset. | ||
|
||
### Usage | ||
|
||
Import the preset and register. This will register all the chart plugins under nvd3. | ||
|
||
```js | ||
import { NVD3ChartPreset } from '@superset-ui/legacy-preset-chart-nvd3'; | ||
|
||
new NVD3ChartPreset().register(); | ||
``` | ||
|
||
or register charts one by one. 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 { AreaChartPlugin, LineChartPlugin } from '@superset-ui/legacy-preset-chart-nvd3'; | ||
|
||
new AreaChartPlugin() | ||
.configure({ key: 'area' }) | ||
.register(); | ||
new LineChartPlugin() | ||
.configure({ key: 'line' }) | ||
.register(); | ||
``` | ||
|
||
Then use it via `SuperChart`. See [storybook](https://apache-superset.github.io/superset-ui-plugins/?selectedKind=plugin-chart-nvd3) for more details. | ||
|
||
```js | ||
<SuperChart | ||
chartType="line" | ||
width={600} | ||
height={600} | ||
formData={...} | ||
queryData={{ | ||
data: {...}, | ||
}} | ||
/> | ||
``` |
53 changes: 53 additions & 0 deletions
53
...erset_ui/superset-ui-plugins-deckgl/packages/superset-ui-preset-chart-deckgl/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "@superset-ui/legacy-preset-chart-deckgl", | ||
"version": "0.11.0", | ||
"description": "Superset Legacy Chart - deck.gl", | ||
"sideEffects": [ | ||
"*.css" | ||
], | ||
"main": "lib/index.js", | ||
"module": "esm/index.js", | ||
"files": [ | ||
"esm", | ||
"lib" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/apache-superset/superset-ui-plugins-deckgl.git" | ||
}, | ||
"keywords": [ | ||
"superset" | ||
], | ||
"author": "Superset", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/apache-superset/superset-ui-plugins-deckgl/issues" | ||
}, | ||
"homepage": "https://github.com/apache-superset/superset-ui-plugins-deckgl#readme", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@data-ui/xy-chart": "^0.0.80", | ||
"d3": "^3.5.17", | ||
"d3-tip": "^0.9.1", | ||
"dompurify": "^1.0.3", | ||
"fast-safe-stringify": "^2.0.6", | ||
"lodash": "^4.17.11", | ||
"mathjs": "^3.20.2", | ||
"moment": "^2.20.1", | ||
"nvd3": "1.8.6", | ||
"prop-types": "^15.6.2", | ||
"urijs": "^1.18.10" | ||
}, | ||
"peerDependencies": { | ||
"@superset-ui/chart": "^0.12.0", | ||
"@superset-ui/color": "^0.12.0", | ||
"@superset-ui/core": "^0.12.0", | ||
"@superset-ui/dimension": "^0.12.0", | ||
"@superset-ui/number-format": "^0.12.0", | ||
"@superset-ui/time-format": "^0.12.0", | ||
"@superset-ui/translation": "^0.12.0", | ||
"react": "^15 || ^16" | ||
} | ||
} |
115 changes: 115 additions & 0 deletions
115
...plugins-deckgl/packages/superset-ui-preset-chart-deckgl/src/AnimatableDeckGLContainer.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** | ||
* 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 | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* 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. | ||
*/ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import DeckGLContainer from './DeckGLContainer'; | ||
import PlaySlider from '../PlaySlider'; | ||
|
||
const PLAYSLIDER_HEIGHT = 20; // px | ||
|
||
const propTypes = { | ||
getLayers: PropTypes.func.isRequired, | ||
start: PropTypes.number.isRequired, | ||
end: PropTypes.number.isRequired, | ||
getStep: PropTypes.func, | ||
values: PropTypes.array.isRequired, | ||
aggregation: PropTypes.bool, | ||
disabled: PropTypes.bool, | ||
viewport: PropTypes.object.isRequired, | ||
children: PropTypes.node, | ||
mapStyle: PropTypes.string, | ||
mapboxApiAccessToken: PropTypes.string.isRequired, | ||
setControlValue: PropTypes.func, | ||
onViewportChange: PropTypes.func, | ||
onValuesChange: PropTypes.func, | ||
}; | ||
|
||
const defaultProps = { | ||
aggregation: false, | ||
disabled: false, | ||
mapStyle: 'light', | ||
setControlValue: () => {}, | ||
onViewportChange: () => {}, | ||
onValuesChange: () => {}, | ||
}; | ||
|
||
export default class AnimatableDeckGLContainer extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.onViewportChange = this.onViewportChange.bind(this); | ||
} | ||
onViewportChange(viewport) { | ||
const originalViewport = this.props.disabled | ||
? { ...viewport } | ||
: { ...viewport, height: viewport.height + PLAYSLIDER_HEIGHT }; | ||
this.props.onViewportChange(originalViewport); | ||
} | ||
render() { | ||
const { | ||
start, | ||
end, | ||
getStep, | ||
disabled, | ||
aggregation, | ||
children, | ||
getLayers, | ||
values, | ||
onValuesChange, | ||
viewport, | ||
setControlValue, | ||
mapStyle, | ||
mapboxApiAccessToken, | ||
} = this.props; | ||
const layers = getLayers(values); | ||
|
||
// leave space for the play slider | ||
const modifiedViewport = { | ||
...viewport, | ||
height: disabled ? viewport.height : viewport.height - PLAYSLIDER_HEIGHT, | ||
}; | ||
|
||
return ( | ||
<div> | ||
<DeckGLContainer | ||
viewport={modifiedViewport} | ||
layers={layers} | ||
setControlValue={setControlValue} | ||
mapStyle={mapStyle} | ||
mapboxApiAccessToken={mapboxApiAccessToken} | ||
onViewportChange={this.onViewportChange} | ||
/> | ||
{!disabled && | ||
<PlaySlider | ||
start={start} | ||
end={end} | ||
step={getStep(start)} | ||
values={values} | ||
range={!aggregation} | ||
onChange={onValuesChange} | ||
/> | ||
} | ||
{children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
AnimatableDeckGLContainer.propTypes = propTypes; | ||
AnimatableDeckGLContainer.defaultProps = defaultProps; |
Oops, something went wrong.