-
Notifications
You must be signed in to change notification settings - Fork 77
Charts plugins development integration in Superset #342
Comments
It appears that
|
Did you get a message about missing |
I dont recall that but you might need to trigger |
I got the same.
I also did an @trepmag your posts were really helpful. I've been poking around the superset repos looking to see what needs to be done to make a functional visualization plugin. Aside from adding to Looks to me like |
Things did not really work out that well for me, partly cause I was importing I decided to do what the official plugins do, which is to let the main entry be Though to get this to work, you must first build your plugins by running
This will appear if you have already did
I agree. It's not the best, not especially if you want to just package things up in docker. I'm keeping an eye out on item 4 in SIP-38. But for now, editing the |
Thanks @japorized that's great, I've got it compiling now.
Same here. While tinkering around with the plugin I'm running |
Little follow up:
|
Interesting @spatialbits. Thanks for the follow up. Will give that a try on my end as well. Just a side question, though still on the topic; how does one get the data from the Flask backend into our visualizations? I've poked around with the |
I was getting that too. I ended up adding some controls to the control panel in the DummyChart plugin: export default class DummyChartPlugin extends ChartPlugin {
constructor() {
// What is loaded here is an object that implements the ChartPluginConfig interface
super({
// loadChart: () => import('./DummyChart'), // lazy load it.
Chart: DummyChart, // or load it directly.
controlPanel: {
controlPanelSections: [
{
label: t('Query'),
expanded: true,
controlSetRows: [
['all_columns_x', 'all_columns_y'],
['adhoc_filters'],
['row_limit', null]
],
},
]
},
metadata,
transformProps,
});
}
} Then the Now I'm still not a 100% clear on how query the syntax goes, I think you have to hunt around the other def query_obj(self):
form_data = self.form_data
d = super().query_obj()
d["is_timeseries"] = self.form_data.get("time_series_option", "not_time")
for x, y and size"))
d["columns"] = [form_data.get("all_columns_x"), form_data.get("all_columns_y")]
return d Which seems to tell the query builder to select those columns from the db. You also need to override the def get_data(self, df: pd.DataFrame) -> VizData:
data = # do something to your dataframe to get the data you want, make it json serializable
return {'somedata': data} Then lastly, and back in your plugin, you see the export default function transformProps(chartProps: ChartProps) {
console.log('Transforming props for Dummy Chart', chartProps);
const { width, height, formData, queryData } = chartProps;
const { color } = formData;
const { data } = queryData;
return {
width,
height,
color,
data,
};
} Then lastly, in export type DummyChartProps = {
height: number;
width: number;
data: { somedata: number };
};
export default class DummyChart extends React.PureComponent<DummyChartProps> {
render() {
const { data, height, width } = this.props;
return (
<div style={{height, width}}>
<span>{data.somedata}</span>
</div>
);
} There's a lot I still have to work out. Please feel free to point out anything you see wrong there. |
Hi, I took a dab and made importing ts files from plugins work more smoothly: apache/superset#9326 There's still some issue related to React hot reloading that I wasn't able to resolve. The PR has more details. If someone could help me debug or have ideas for directions, that would be great! |
Hi All,
Unfortunately in the explore page i don't see my plugin. I always have the same error, in the exploration shows me the name of the key with which I registered the plugin and in the console of the browser in the url
returns This is my view after the created of the new chart: Could someone help me? Thank you |
That really is where the readme ends and we're sort of left with digging around. I apologize that I don't have a clean answer for you, but try looking at the You may run into an |
Yeah, I get how you feel cause I was in the same boat. I think the discussion right now on the main Superset repo is that the project is trying to figure out how to easily let 3rd party visualizations be added to Superset without them having to modify Superset in any way, so a plugin system. However, this is not so much of a priority for the project right now, so things on this front are moving at a slower pace. I apologize that I can’t be of much help but good luck! |
…set#342) Bumps [lint-staged](https://github.com/okonet/lint-staged) from 10.1.1 to 10.1.2. - [Release notes](https://github.com/okonet/lint-staged/releases) - [Commits](lint-staged/lint-staged@v10.1.1...v10.1.2) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Hello,
I successfully implemented a custom chart which work inside a storybook following the repo here: https://github.com/apache-superset/superset-ui-plugins-template.
Now, I'm trying to integrate that custom chart into a superset instance.
Update; I found some indication at https://github.com/apache-superset/superset-ui/blob/master/docs/debugging.md which mention npm link to hook plugins into a Superset instance.
So I did this as follow:
incubator-superset/docker/
incubator-superset/superset-frontend/
triggernpm run dev-server
superset-plugins-template/package/superset-ui-plugin-chart-dummy
hitnpm link
incubator-superset/superset-frontend/
hitnpm link superset-ui-plugin-chart-dummy
incubator-superser/superset-frontend/src/visualizations/presets/MainPreset.js
add below the othersimport DummyChartPlugin from 'superset-ui-plugin-chart-dummy/src';
Now the last step make the dev server return an error:
The text was updated successfully, but these errors were encountered: