During page render, after said global object is available in context, plugin files are loaded via tags, per the ordering and fully qualified URL configured in admin.Say Metabase, mbplugins something (we'll find a safe name) Page render begins, with the javascript block of metabase loaded and a global object in the window created.Perhaps some way to simply specify client-side scripts (in the config, manifest, etc) via a browser URL + some sort of mechanism for the scripts to load themselves per their needs? Something along the lines of having a client side page load lifecycle with "cutpoints" if you will. Version control, debugging, etc all become pretty painful when there's a lot of moving pieces to get setup. Providing Jars and compile time solutions also are not ideal, imo. Everything else would be the chart implementor's That's one way, but personally it feels pretty nasty/hacky. at chart load time, the Metabase engine executes the query as normal and calls the configured js class/method and hands it the data structure mentioned above:Īnd that's it.custom chart config in Metabase takes a) a textbox with any js libraries and css files it should import at most once per dashboard/question page, b) a textbox full of arbitrary js it should place in a script tag where the chart goes, c) the name of a javascript class and callback method it should expect to find in the window context, d) maybe a css class name or something to apply to the containing div, oh and e) the query, of course.If I were the one doing it, the basic design would be: For example, this feature ( #5474) has a lot of upvotes, but if there were a custom chart type then its OP could actually just do it themselves with d3. I recognize that many other features have more votes than this one, but at the same time this feature would be a great "get out of jail free" card that frees people up to solve their own problems without waiting for releases. Hey guys, it's been a while since the last comment on this and wondering what the thinking is? I might even be willing to do the coding myself since I need this so badly, but wouldn't want to do that if it's something the maintainers don't actually like or have an appetite for. That said, if you're willing to recompile, and ok with the possibility the API might break with future updates, here are the basic steps:īasically the React component takes a prop data that has a cols array containing metadata about the returned columns, and a rows array containing each rows' values as another array, i.e. Second, we don't currently have a supported way to add custom charts. to use a more limited declarative API such as vega or vega-lite which we could provide an in-app editor for.to build and upload fully custom visualizations using arbitrary JavaScript libraries you provide (D3, React, etc).First, I'm curious what would your ideal way of adding custom charts be? Do you want:
0 Comments
Leave a Reply. |