- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 python-highcharts包来生成钻取柱形图。我已经运行了 drilldown example * 在该存储库上,它给了我以下代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link href="https://www.highcharts.com/highslide/highslide.css" rel="stylesheet" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://code.highcharts.com/6/highcharts.js"></script>
<script type="text/javascript" src="https://code.highcharts.com/6/highcharts-more.js"></script>
<script type="text/javascript" src="https://code.highcharts.com/6/modules/heatmap.js"></script>
<script type="text/javascript" src="https://code.highcharts.com/6/modules/exporting.js"></script>
<script type="text/javascript" src="https://code.highcharts.com/modules/drilldown.js"></script>
</head>
<body style="margin:0;padding:0">
<div id="container" style="width:850px;height:400px;">Loading....</div>
<script>
$(function(){
Highcharts.setOptions({"global": {}, "lang": {}});
var option = {"chart": {"renderTo": "container", "width": 850, "height": 400, "type": "column"}, "colors": {}, "credits": {"enabled": false}, "drilldown": {}, "exporting": {}, "labels": {}, "legend": {"enabled": false}, "loading": {}, "navigation": {}, "pane": {}, "plotOptions": {"series": {"borderWidth": 0, "dataLabels": {"enabled": true, "format": "{point.y:.1f}%"}}}, "series": {}, "subtitle": {"text": "Click the columns to view versions. Source: <a href=\"http://netmarketshare.com\">netmarketshare.com</a>."}, "title": {"text": "Browser market shares. January, 2015 to May, 2015"}, "tooltip": {"headerFormat": "<span style=\"font-size:11px\">{series.name}</span><br>", "pointFormat": "<span style=\"color:{point.color}\">{point.name}</span>: <b>{point.y:.2f}%</b> of total<br/>"}, "xAxis": {"type": "category"}, "yAxis": {"title": {"text": "Total percent market share"}}};
var drilldowndata = [{"data": [["v11.0", 24.13], ["v8.0", 17.2], ["v9.0", 8.11], ["v10.0", 5.33], ["v6.0", 1.06], ["v7.0", 0.5]], "type": "column", "name": "Microsoft Internet Explorer", "id": "Microsoft Internet Explorer"}, {"data": [["v40.0", 5], ["v41.0", 4.32], ["v42.0", 3.68], ["v39.0", 2.96], ["v36.0", 2.53], ["v43.0", 1.45], ["v31.0", 1.24], ["v35.0", 0.85], ["v38.0", 0.6], ["v32.0", 0.55], ["v37.0", 0.38], ["v33.0", 0.19], ["v34.0", 0.14], ["v30.0", 0.14]], "type": "column", "name": "Chrome", "id": "Chrome"}, {"data": [["v35", 2.76], ["v36", 2.32], ["v37", 2.31], ["v34", 1.27], ["v38", 1.02], ["v31", 0.33], ["v33", 0.22], ["v32", 0.15]], "type": "column", "name": "Firefox", "id": "Firefox"}, {"data": [["v8.0", 2.56], ["v7.1", 0.77], ["v5.1", 0.42], ["v5.0", 0.3], ["v6.1", 0.29], ["v7.0", 0.26], ["v6.2", 0.17]], "type": "column", "name": "Safari", "id": "Safari"}, {"data": [["v12.x", 0.34], ["v28", 0.24], ["v27", 0.17], ["v29", 0.16]], "type": "column", "name": "Opera", "id": "Opera"}];
option.drilldown.series = drilldowndata;
var chart = new Highcharts.Chart(option);
var data = [{"data": [{"name": "Microsoft Internet Explorer", "y": 56.33, "drilldown": "Microsoft Internet Explorer"}, {"name": "Chrome", "y": 24.030000000000005, "drilldown": "Chrome"}, {"name": "Firefox", "y": 10.38, "drilldown": "Firefox"}, {"name": "Safari", "y": 4.77, "drilldown": "Safari"}, {"name": "Opera", "y": 0.9100000000000001, "drilldown": "Opera"}, {"name": "Proprietary or Undetectable", "y": 0.2, "drilldown": null}], "type": "column", "name": "Brands", "colorByPoint": true}];
var dataLen = data.length;
for (var ix = 0; ix < dataLen; ix++) {
chart.addSeries(data[ix]);
}
});
</script>
</body>
</html>
在最近的浏览器(最新的 Google Chrome)中打开时,会绘制图表,但向下钻取功能不起作用。我看过其他工作示例,例如 this one但无法弄清楚为什么我的代码不起作用。
为什么这段代码没有制作正确的向下钻取图表以及如何修复它?
*请注意,由于我希望图表位于单个文件中,因此我已将 python 脚本的最后一行 (H.htmlcontent
) 替换为 H.save_file("test_hc")
.
最佳答案
您的模块版本不兼容:
<script type="text/javascript" src="https://code.highcharts.com/modules/drilldown.js"></script>
应该是:
<script type="text/javascript" src="https://code.highcharts.com/6/modules/drilldown.js"></script>
<小时/>
关于javascript - 为什么 python-highcharts 制作的钻取图不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60297629/
今天有小伙伴给我留言问到,try{...}catch(){...}是什么意思?它用来干什么? 简单的说 他们是用来捕获异常的 下面我们通过一个例子来详细讲解下
我正在努力提高网站的可访问性,但我不知道如何在页脚中标记社交媒体链接列表。这些链接指向我在 facecook、twitter 等上的帐户。我不想用 role="navigation" 标记这些链接,因
说现在是 6 点,我有一个 Timer 并在 10 点安排了一个 TimerTask。之后,System DateTime 被其他服务(例如 ntp)调整为 9 点钟。我仍然希望我的 TimerTas
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
我就废话不多说了,大家还是直接看代码吧~ ? 1
Maven系列1 1.什么是Maven? Maven是一个项目管理工具,它包含了一个对象模型。一组标准集合,一个依赖管理系统。和用来运行定义在生命周期阶段中插件目标和逻辑。 核心功能 Mav
我是一名优秀的程序员,十分优秀!