简体   繁体   English

如何将 Apache Superset 图表嵌入到 React 应用程序中

[英]How to embede Apache Superset chart into React app

I want to embed my chart from Apache Superset into my React.js App.我想将 Apache Superset 中的图表嵌入到我的 React.js 应用程序中。 So far I know there is possibility to use like this:到目前为止,我知道可以这样使用:

<iframe
        id="myIFRAME"
        width="1600"
        height="1200"
        seamless
        frameBorder="10"
        scrolling="no"
        src="http://localhost:8080/r/3"
      >
</iframe>

It works fine but I want to use only a chart with filter options without all the superset dashbord pane:它工作正常,但我只想使用带有过滤器选项的图表,而不使用所有超集仪表板窗格: 在此处输入图像描述

I was trying to use https://www.npmjs.com/package/@superset-ui/core but there is no good documentation how to use it and it require to downgrade react version to 16, while I think in my project will be better newer version.我试图使用https://www.npmjs.com/package/@superset-ui/core但没有很好的文档如何使用它并且它需要将反应版本降级到 16,而我认为在我的项目中会更好的新版本。

Currently I am trying to manipulate things inside iframe by catching things by目前我正在尝试通过以下方式捕捉东西来操纵 iframe 内部的东西

var iframe = document.getElementById("myIFRAME");
  var elmnt = iframe.contentWindow.document.getElementsByClassName(
    "dashboard-content css-185d7vi"
  );
   elmnt.style.display = "none";

But i think it's not a good way to do this and Im getting errors with CORS and Consider adding an error boundary to your tree to customize error handling behavior.但我认为这不是执行此操作的好方法,我收到CORS错误并Consider adding an error boundary to your tree to customize error handling behavior.

There is an option to add to iframe query attribute standalone=true..有一个选项可以添加到 iframe 查询属性 Standalone=true..

<iframe
        id="myIFRAME"
        width="1600"
        height="1200"
        seamless
        frameBorder="10"
        scrolling="no"
        src="http://localhost:8080/superset/dashboard/world_health/?standalone=true"
      ></iframe>

I think this is helpful for your question.我认为这对您的问题有帮助。

https://superset.apache.org/docs/creating-charts-dashboards/creating-your-first-dashboard/#customizing-dashboard https://superset.apache.org/docs/creating-charts-dashboards/creating-your-first-dashboard/#customizing-dashboard

<iframe
    width="1600"
    height="1600"
    seamless
    frameBorder="0"
    scrolling="yes"
    src="http://127.0.0.1:8088/superset/dashboard/16?standalone=2"
    >
</iframe>

Don't get the URL from ' Copy dashboard URL ' in superset.不要从超集中的“复制仪表板 URL ”中获取 URL。 Instead of that you can get the dashboard URL from the browser link address.相反,您可以从浏览器链接地址获取仪表板 URL。 At the end of the URL simply add ' ?standalone=2 '在 URL 的末尾只需添加 ' ?standalone=2 '

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React 与 apache 超集的集成以显示图表 - React integration with apache superset for showing charts 如何在Apache-superset中的country_map上添加更多指标? - How to add more metrics on the country_map in Apache-superset? 如何在Angular 7应用程序中集成Apache Superset Charts? 身份验证和标头问题 - How to integrate Apache Superset Charts in Angular 7 application? Issue with Authentication and Headers 如何在 Apache Web 服务器上部署 React 应用程序 - How to deploy a React App on Apache web server 如何使用 API 数据正确更新 React &amp; Chart.js 应用程序中的图表 - How to properly update chart in React & Chart.js app using API data Apache 超集中的 JAVASCRIPT 工具提示生成器未显示数据 - JAVASCRIPT tooltip generator in Apache superset is not showing the data 将IPythonNotebook嵌入iframe - Embede IPythonNotebook into iframe react-vega-如何添加下拉菜单以使应用程序对图表进行反应而无vega嵌入? - react-vega - how to add dropdown menu to react app to chart without vega-embed? 如何在Chart.JS中显示饼图中的数据子集,同时在悬停时仍显示超集? - How can I show a subset of data on pie pieces in Chart.JS while still displaying the superset when hovering? 在React应用程序中使D3图表具有响应性 - Making D3 chart Responsive in React app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM