var charts = null;
        $(function () {
            var seriesIds = [830];
            // Create the chart
            charts = new Highcharts.StockChart({
                chart: {
                    renderTo: 'container',
                    borderWidth: 1 //边框宽度
                },
                exporting: {
                    enabled: true //是否能导出趋势图图片  
                },
                title: {
                    text: "AAPL Stock Price(报名统计)", //图表标题  
                    floating: true
                },
                xAxis: {
                    tickPixelInterval: 200,
                    labels: {
                        align: 'center'
                    },
                    dateTimeLabelFormats: {
                        second: '%Y-%m-%d-%H:%M:%S',
                        minute: '%Y-%m-%d-%H:%M',
                        hour: '%Y-%m-%d-%H:%M',
                        day: '%Y-%m-%d',
                        week: '%Y-%m-%d',
                        month: '%Y-%m',
                        year: '%Y'
                    }
                },
                yAxis: {
                    title: {
                        text: "Rate(个数)"  //y轴上的标题  
                    },
                    labels: {
                        //设置纵坐标值的样式 
                        formatter: function () {
                            return this.value + "个";
                        }
                    }
                },
                rangeSelector: {
                    // 缩放选择按钮,是一个数组。
                    // 其中type可以是: 'millisecond', 'second', 'minute', 'day', 'week', 'month', 'ytd' (year to date), 'year' 和 'all'。
                    // 其中count是指多少个单位type。
                    // 其中text是配置显示在按钮上的文字
                    buttons: [{
                        type: 'month',
                        count: 1,
                        text: '1月'
                    }, {
                        type: 'month',
                        count: 3,
                        text: '季度'
                    }, {
                        type: 'year',
                        count: 1,
                        text: '1年'
                    }, {
                        type: 'all',
                        text: '全部'
                    }],
                    //表示以上定义button的index,从0开始
                    selected: 1,
                    //日期输入框中格式
                    inputDateFormat: '%Y-%m-%d'
                },
                tooltip: {
                    xDateFormat: '%Y-%m-%d, %A'//鼠标移动到趋势线上时显示的日期格式  
                },
                series: [],
                //底部滑轮控制
                navigator: {
                    xAxis: {
                        tickPixelInterval: 200,
                        labels: {
                            align: 'right'
                        },
                        dateTimeLabelFormats: {
                            second: '%Y-%m-%d-%H:%M:%S',
                            minute: '%Y-%m-%d-%H:%M',
                            hour: '%Y-%m-%d-%H:%M',
                            day: '%Y-%m-%d',
                            week: '%Y-%m-%d',
                            month: '%Y-%m',
                            year: '%Y'
                        }
                    }
                }
            });

$.each(seriesIds, function (j, pid) {
                $.ajax({
                    type: "post",
                    url: "retrunJsonStr.ashx",
                    async: false,
                    dataType: "text",
                    data: { pid: pid },
                    success: function (json) {
                        charts.addSeries({
                            name: pid,
                            type: 'spline',
                            data: eval('(' + json + ')')
                        }, false);
                        charts.redraw(); //刷新
                    }
                });
            });
        });

function getChart(obj) {
            var pid = $(obj).val();
            var isCk = $(obj).attr("checked");
            if (isCk) {
                $.ajax({
                    type: "post",
                    url: "retrunJsonStr.ashx",
                    async: false,
                    dataType: "text",
                    data: { pid: pid },
                    success: function (json) {
                        charts.addSeries({
                            name: pid,
                            type: 'spline',
                            data: eval('(' + json + ')')

}, false);
                        charts.redraw();
                    }
                });
            } else {
                for (var i = 0; i < charts.series.length; i++) {
                    if (charts.series.name == pid) {
                        charts.series.remove(false);
                    }
                }
                charts.redraw();
            }
        }

最新文章

  1. Hyper-V 激活Windows系统重启后黑屏的解决方法 + 激活方法
  2. TWS笔试题---回家想了想答案,希望对jobseeker有帮助
  3. Spring:Aop before after afterReturn afterThrowing around 的原理
  4. iis6 服务器做301跳转返回状态码200解决方法。
  5. console对象-转
  6. 【HDU 4305】Lightning(生成树计数)
  7. 数据结构算法C语言实现(五)---2.3重新定义线性链表及其基本操作
  8. h5移动端滑动的细节
  9. WPF的Timer控件的使用WPF的Timer控件的使用
  10. Google地图接口API之地图类型(六)
  11. Jmeter Constant Throughput Timer 使用
  12. 深度优先搜索——迷宫问题(华为oj)
  13. 汇编转移指令jmp原理
  14. 编写高质量的Python代码系列(八)之部署
  15. mysql 从一个表中查询,插入到另一个表中
  16. JAVA发红包案例
  17. pytorch安装(使用pip3装到conda环境下)
  18. Android CheckBox修改大小、边框颜色,以及自定义CheckBox;
  19. Android x86模拟器Intel Atom x86 System Image配置与使用方法
  20. 【刷题】BZOJ 3653 谈笑风生

热门文章

  1. [javase学习笔记]-6.4 成员变量与局部变量
  2. css的overflow属性
  3. linux命令大全网站
  4. (转)【风宇冲】Unity3D教程宝典之AssetBundles:第二讲
  5. OpenGL中的原子操作需要注意的地方
  6. Git创建分支/GIT提交分支
  7. java实现高性能的数据同步
  8. template.helper 多参数
  9. MVC4发布到IIS,出现HTTP 错误 404.0 - Not Found
  10. C#学习记录二:高级数据存储方式