1、选择charts的url
2、把url嵌入到静态页面
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-Frame-Options" content="deny">
<title></title>
<style type="text/css">
.dashboard {
width: 100%;
margin: 0 auto;
}
.dashboard iframe {
width: 100%;
height: 900px;
border: 0;
scrolling: "no";
margin-top: -150px;
}
</style>
</head>
<body>
<iframe
width="1300"
height="1000"
seamless
frameBorder="0"
scrolling="no"
src="http://*******:****/superset/explore/?form_data=%7B%22datasource%22%3A%2222__table%22%2C%22viz_type%22%3A%22dist_bar%22%2C%22slice_id%22%3A78%2C%22url_params%22%3A%7B%7D%2C%22granularity_sqla%22%3Anull%2C%22time_grain_sqla%22%3A%22P1D%22%2C%22time_range%22%3A%22100+years+ago+%3A+%22%2C%22metrics%22%3A%5B%7B%22expressionType%22%3A%22SIMPLE%22%2C%22column%22%3A%7B%22id%22%3A466%2C%22column_name%22%3A%22NUMSS%22%2C%22verbose_name%22%3Anull%2C%22description%22%3Anull%2C%22expression%22%3A%22%22%2C%22filterable%22%3Atrue%2C%22groupby%22%3Atrue%2C%22is_dttm%22%3Afalse%2C%22type%22%3A%22BIGINT%22%2C%22database_expression%22%3Anull%2C%22python_date_format%22%3Anull%2C%22optionName%22%3A%22_col_NUMSS%22%7D%2C%22aggregate%22%3A%22SUM%22%2C%22sqlExpression%22%3Anull%2C%22hasCustomLabel%22%3Afalse%2C%22fromFormData%22%3Afalse%2C%22label%22%3A%22SUM%28NUMSS%29%22%2C%22optionName%22%3A%22metric_j30jw682ww_iy5w77nh78%22%7D%5D%2C%22adhoc_filters%22%3A%5B%5D%2C%22groupby%22%3A%5B%22DEPT_ADMISSION_TO_NAME%22%5D%2C%22columns%22%3A%5B%5D%2C%22row_limit%22%3A1000%2C%22contribution%22%3Afalse%2C%22color_scheme%22%3A%22d3Category20%22%2C%22show_legend%22%3Atrue%2C%22show_bar_value%22%3Afalse%2C%22bar_stacked%22%3Afalse%2C%22order_bars%22%3Atrue%2C%22y_axis_format%22%3A%22.3s%22%2C%22y_axis_label%22%3A%22%E5%87%BA%E9%99%A2%E4%BA%BA%E6%95%B0%22%2C%22show_controls%22%3Afalse%2C%22x_axis_label%22%3A%22%E7%A7%91%E5%AE%A4%E5%90%8D%E7%A7%B0%22%2C%22bottom_margin%22%3A%22auto%22%2C%22x_ticks_layout%22%3A%22auto%22%2C%22reduce_x_ticks%22%3Afalse%7D&standalone=true&height=400"
>
</iframe>
</body>
</html>
3、访问静态页面
解决方案:修改superset的config.py配置文件
PUBLIC_ROLE_LIKE_GAMMA = False给为True;
HTTP_HEADERS = {'X-Frame-Options': 'SAMEORIGIN'}注释掉;
# HTTP_HEADERS = {} 注释去掉
再次访问页面: