javascript - Highcharts 仪表不显示

标签 javascript highcharts gauge

我对 Highcharts 仪表有疑问。 实际上,它没有显示,我有一个 JS 错误。

TypeError: $[b.defaultSeriesType] 不是构造函数 highcharts.js(第 159 行)

我有 3 个选项卡(使用 bootstrap/jquery),另外两个选项卡中有饼图,这些选项卡没有问题。

我不明白,因为我刚刚从 Highcharts 网站上复制了示例。有谁知道可能导致这种情况的原因吗?

编辑:

这是JS的一部分

chart = new Highcharts.Chart({

                                chart : {
                                    renderTo : 'container',
                                    type : 'gauge',
                                    plotBackgroundColor : null,
                                    plotBackgroundImage : null,
                                    plotBorderWidth : 0,
                                    plotShadow : false
                                },

                                title : {
                                    text : 'Speedometer'
                                },

                                pane : {
                                    startAngle : -150,
                                    endAngle : 150,
                                    background : [
                                            {
                                                backgroundColor : {
                                                    linearGradient : {
                                                        x1 : 0,
                                                        y1 : 0,
                                                        x2 : 0,
                                                        y2 : 1
                                                    },
                                                    stops : [
                                                            [ 0, '#FFF' ],
                                                            [ 1, '#333' ] ]
                                                },
                                                borderWidth : 0,
                                                outerRadius : '109%'
                                            },
                                            {
                                                backgroundColor : {
                                                    linearGradient : {
                                                        x1 : 0,
                                                        y1 : 0,
                                                        x2 : 0,
                                                        y2 : 1
                                                    },
                                                    stops : [
                                                            [ 0, '#333' ],
                                                            [ 1, '#FFF' ] ]
                                                },
                                                borderWidth : 1,
                                                outerRadius : '107%'
                                            }, {
                                            // default background
                                            }, {
                                                backgroundColor : '#DDD',
                                                borderWidth : 0,
                                                outerRadius : '105%',
                                                innerRadius : '103%'
                                            } ]
                                },

                                // the value axis
                                yAxis : {
                                    min : 0,
                                    max : 200,

                                    minorTickInterval : 'auto',
                                    minorTickWidth : 1,
                                    minorTickLength : 10,
                                    minorTickPosition : 'inside',
                                    minorTickColor : '#666',

                                    tickPixelInterval : 30,
                                    tickWidth : 2,
                                    tickPosition : 'inside',
                                    tickLength : 10,
                                    tickColor : '#666',
                                    labels : {
                                        step : 2,
                                        rotation : 'auto'
                                    },
                                    title : {
                                        text : 'km/h'
                                    },
                                    plotBands : [ {
                                        from : 0,
                                        to : 120,
                                        color : '#55BF3B' // green
                                    }, {
                                        from : 120,
                                        to : 160,
                                        color : '#DDDF0D' // yellow
                                    }, {
                                        from : 160,
                                        to : 200,
                                        color : '#DF5353' // red
                                    } ]
                                },

                                series : [ {
                                    name : 'Speed',
                                    data : [ 80 ],
                                    tooltip : {
                                        valueSuffix : ' km/h'
                                    }
                                } ]
                            });

在我的 html 中有这个

<div class="tab-pane fade" id="requetesSeconde">

            <div id="container"
                style="width: 400px; height: 300px; margin: 0 auto"></div>


        </div>

最佳答案

问题是你没有包含 highcharts-more.js 文件

关于javascript - Highcharts 仪表不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14984774/

相关文章:

javascript - 是否有办法将 X 或 O 记录到数据数组中以检查获胜者?

highcharts - 如何开发带有框注释的自定义图表,如附图所示

javascript - 具有多个颜色区域的 Google Chart Gauge

javascript - 有没有办法在 closeNav 函数上轻松地将我的汉堡包菜单图标改回三行?

javascript - Mocha 是否提供参数化测试 "@Theory"样式的选项?

javascript - 带有负堆栈的 Highcharts 条 : how to position data labels

javascript - PIE CHART - 使用 DataTables 和 Highcharts 进行数据可视化

c - 如何使用 gtk+ 在 cairo 中重绘文本

javascript - jquery empty - 如果没有内容则删除 html 标签