How to add custom visualisation to Superset?
Make sure these boxes are checked before submitting your issue - thank you!
- [ ] I have checked the superset logs for python stacktraces and included it here as text if there are any.
- [ ] I have reproduced the issue with at least the latest released version of superset.
- [ ] I have checked the issue tracker for the same issue and I haven't found one similar.
Superset version
Expected results
Actual results
Steps to reproduce
Can anyone guide me to create my own custom visualisation in Superset?
You can add the echarts into the superset
You can add the echarts into the superset
Hey XuanmoFeng, Can you explain it? I didn't get you.
Hey ,Can tests above version 0.28.0 be used?I'm using 'python3.7' right now.
const propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({
country_id: PropTypes.string,
metric: PropTypes.number,
})),
width: PropTypes.number,
height: PropTypes.number,
country: PropTypes.string,
linearColorScheme: PropTypes.string,
mapBaseUrl: PropTypes.string,
numberFormat: PropTypes.string,
sliceId: PropTypes.number,
};
function EchartsCountryMap(element, props) {
const {
data,
width,
height,
country,
linearColorScheme,
mapBaseUrl = '/static/assets/src/visualizations/EchartsCountryMap/countries',
numberFormat,
sliceId,
} = props;
const div = d3.select(element);
const sliceID = 'echarts_slice_' + sliceId;
const html = '<div id=' + sliceID + ' style="width:' + width + 'px;height:' + height + 'px;"></div>';
div.html(html); // reset
const myChart = echarts.init(document.getElementById(sliceID));
.......
You can write others codes like the countryMap
const propTypes = { data: PropTypes.arrayOf(PropTypes.shape({ country_id: PropTypes.string, metric: PropTypes.number, })), width: PropTypes.number, height: PropTypes.number, country: PropTypes.string, linearColorScheme: PropTypes.string, mapBaseUrl: PropTypes.string, numberFormat: PropTypes.string, sliceId: PropTypes.number, }; function EchartsCountryMap(element, props) { const { data, width, height, country, linearColorScheme, mapBaseUrl = '/static/assets/src/visualizations/EchartsCountryMap/countries', numberFormat, sliceId, } = props; const div = d3.select(element); const sliceID = 'echarts_slice_' + sliceId; const html = '<div id=' + sliceID + ' style="width:' + width + 'px;height:' + height + 'px;"></div>'; div.html(html); // reset const myChart = echarts.init(document.getElementById(sliceID)); .......You can write others codes like the countryMap
Thank you @XuanmoFeng
const propTypes = { data: PropTypes.arrayOf(PropTypes.shape({ country_id: PropTypes.string, metric: PropTypes.number, })), width: PropTypes.number, height: PropTypes.number, country: PropTypes.string, linearColorScheme: PropTypes.string, mapBaseUrl: PropTypes.string, numberFormat: PropTypes.string, sliceId: PropTypes.number, }; function EchartsCountryMap(element, props) { const { data, width, height, country, linearColorScheme, mapBaseUrl = '/static/assets/src/visualizations/EchartsCountryMap/countries', numberFormat, sliceId, } = props; const div = d3.select(element); const sliceID = 'echarts_slice_' + sliceId; const html = '<div id=' + sliceID + ' style="width:' + width + 'px;height:' + height + 'px;"></div>'; div.html(html); // reset const myChart = echarts.init(document.getElementById(sliceID)); .......You can write others codes like the countryMap
Is there any reference how to write echarts code?
#6812
Hi, Is there any way to add choropleth map/custom map/ or new visualization chart for current version. thanks