• 手机版

    扫码体验手机版

  • 微信公众号

    扫码关注公众号

国内首家协议开发

软芯音视解码保护平台

在线
客服

发布
需求

在线
聊天

天盟
APP

天盟APP下载

关注
微信

微信扫一扫访问
顶部

highcharts,数据也有了,图表就是出不来 。啥原因

//创建图表
        chart_tsd = Highcharts.stockChart('stock_line', {
                chart: {
                        marginLeft: 0,
                        marginRight: 0,
                        marginBottom: 0,
                        panning:false,
                        pinchType:'',
                        events: {
                                load: function() {
                                        var date = new Date();
                                        var myhours = date.getHours();
                                        var myminute = date.getMinutes();
                                        var mysecond = date.getSeconds();
                                        if (myhours == 9 && myminute >= 30) { //每日早上9:30分后开始启用定时器
                                                timeTicket(this);
                                        } else if (myhours > 9) {
                                                timeTicket(this);


                                        }
                                }
                        }
                },
                rangeSelector: {
                        enabled: false
                },
                exporting: {
                        enabled: false
                },
                navigator: {
                        enabled: false
                },
                scrollbar: {
                        enabled: false
                },
                credits: {
                        enabled: false
                },
                tooltip: {
                        enabled: false
                },
                plotOptions: {
                        series: {
                                states: {
                                        hover: {
                                                lineWidth: 1
                                        }
                                }
                        }
                },
                xAxis: {
                        tickInterval: 60 * 1000 * 60,
                        min: minTime,
                        max: maxTime,
                        gridLineColor: '#f8f8f8',
                        gridLineDashStyle: 'dotted',
                        gridLineWidth: 1,
                        tickWidth: 0,
                        tickColor: '#000',
                        lineColor: '#f8f8f8',
                        breaks: breakss, //上午场最终时间无缝连接下午场开始时间
                        tickPositioner: function() {
                                return positions;
                        },
                        labels: {
                                y:0,
                                formatter: function() {
                                        var tt = Highcharts.dateFormat("%H:%M", this.value);
                                        if (tt == "11:30"){
                                                tt = "11:30/13:00";
                                        }
                                        return tt;
                                }
                        }
                },
                yAxis: [{ //y轴右
                        allowDecimals: true,
                        showFirstLabel: true,
                        showLastLabel: true,
                        opposite: true,
                        height: '70%',
                        gridLineWidth: 0,
                        labels: {
                                overflow: 'justify',
                                useHTML: true,
                                align: 'right',
                                x: 0,
                                formatter: function() {
                                        chartNumR++;
                                        var vDate = decimal2(parseFloat(this.value));
                                        if ((chartNumR%labelNumR) == 1) {
                                                return '' + vDate + "%" + '';
                                        } else if ((chartNumR%labelNumR) == 0) {
                                                return '' + vDate + "%" + '';
                                        } else {
                                                return '' + vDate + "%" + '';
                                        }
                                }
                        },
                        tickPositioner: function() {
                                var ypositions = [min_PricePer, 0, max_PricePer];
                                labelNumR = ypositions.length;
                                return ypositions;
                        }
                }, { //y轴左
                        max: max_preclosePx,
                        min: min_preclosePx,
                        height: '70%',
                        allowDecimals: true,
                        showFirstLabel: true,
                        showLastLabel: true,
                        opposite: false,
                        gridLineWidth: 0,
                        labels: {
                                overflow: 'justify',
                                useHTML: true,
                                align: 'left',
                                x: 0,
                                formatter: function() {
                                        chartNumL++;
                                        if (this.value > 100000) {
                                                this.value = preclosePx;
                                        }
                                        if (this.value > 10000) {
                                                var vDate = Math.ceil(this.value);
                                        } else if (this.value >= 100) {
                                                var vDate = decimal2(parseFloat(this.value));
                                        } else {
                                                var vDate = decimal2(parseFloat(this.value));
                                        }
                                        if ((chartNumL%labelNumL) == 1) {
                                                return '' + vDate + '';
                                        } else if ((chartNumL%labelNumL) == 0) {
                                                return '' + vDate + '';
                                        } else {
                                                return '' + vDate + '';
                                        }
                                }
                        },
                        plotLines: [{ //昨收
                                color: 'red',
                                dashStyle: 'Dot',
                                value: preclosePx,
                                width: 1,
                                zIndex: 99
                        }],
                        tickPositioner: function() {
                                var ypositions = [min_Price, preclosePx, max_Price];
                                labelNumL = ypositions.length;
                                return ypositions;
                        },
                        gridLineColor: '#f8f8f8',
                }, { //交易量y轴
                        height: '15%',
                        top: '80%',
                        offset: 0,
                        gridLineWidth: 0,
                        showFirstLabel: true,
                        showLastLabel: true,
                        gridLineColor: '#f8f8f8',
                        opposite: false,
                        labels: {
                                overflow: 'justify',
                                x: 0,
                                align: 'left',
                                formatter: function() {
                                        return parseInt(this.value);
                                }
                        }
                }],
                series: [{
                        type: 'area',
                        name: '最新价',
                        lineWidth: 1,
                        fillColor: {
                                linearGradient: {
                                        x1: 0,
                                        y1: 0,
                                        x2: 0,
                                        y2: 1
                                },
                                stops: [
                                        [0, '#A6CDF2'],
                                        [1, Highcharts.Color('#A6CDF2').setOpacity(0).get('rgba')]
                                ]
                        },
                        data: tData0.tValues0,
                        dataGrouping: {
                                enabled: false,
                        },
                        zIndex: 100,
                        yAxis: 1
                }, {
                        name: '日均价',
                        type: 'line',
                        data: tData1.tValues1,
                        color: '#f7ce28',
                        lineWidth: 1,
                        dataGrouping: {
                                enabled: false,
                        },
                        yAxis: 1
                }, {
                        name: '交易量',
                        type: 'column',
                        data: tData2,
                        color: '#9DC8F1',
                        yAxis: 1,
                        dataGrouping: {
                                enabled: false
                        },
                        yAxis: 2
                },{
                        name : '实时价',
                        type: 'scatter',
                        data : series3_data,
                        zIndex: 200,
                        yAxis: 1
                }]
        });
//console.log(typeof tData0.tValues0);
}

免责声明:本内容仅代表回答会员见解不代表天盟观点,请谨慎对待。

版权声明:作者保留权利,不代表天盟立场。

使用道具 举报

发新帖

发布任务需求已有1031168位用户正在使用天盟网服务

发布分类: *
任务预算: *
需求内容: *
手机号码: *
任务商家报价为
  • 预算价 :
  • 成交价 :
  • 完工期 :
  • 质保期 :

* 最终任务项目以服务商报价、双方协商为准!