• 曲线图


    HTML:

     <div class="zxt" style="100%;height:100%;"><div id="main" style="100%;height:100%;border:0px solid #ccc;padding:0;"></div></div>

    JS:

     <script src="js/echarts.js"></script>

    arrtext = ["03", "04", "05", "06", "07", "08", "09"],arrvalue = [0, 1, 0, 0, 0, 4, 3] 

    CreateLine(arrtext, arrvalue, 'main', '#b2b2b2'); 

    function CreateLine(text,value,id,backcolor) {
            require.config({
                paths: {
                    echarts: './js'
                }
            });
            require(
                [
                    'echarts',
                    'echarts/chart/line'
                ],
                function (ec) {
                    //--- 折柱 ---
                    var myChart = ec.init(document.getElementById(id));
                    myChart.setOption({


                        tooltip: {
                            trigger: 'axis'
                        },
                        backgroundColor: backcolor,

                        //animation:true,
                        toolbox: {
                            show: false,
                            feature: {
                                mark: { show: false },
                                dataView: { show: false, readOnly: false },
                                magicType: { show: true, type: ['line', 'bar'] },
                                restore: { show: false },
                                saveAsImage: { show: false }
                            }
                        },
                        grid: {
                            x: 25,

                            y: 30,
                            x2: 30,
                            y2: 20,
                            borderWidth:0,
                            //borderColor:'#ff0000',
                        },
                        //calculable : true,
                        xAxis: [
                            {
                                type: 'category',
                                name: '时间',
                                axisLine: {    // 轴线
                                    show: true,
                                    lineStyle: {
                                        color: '#656668',
                                        type: 'solid',
                                        0
                                    }
                                },
                                axisTick: {    // 轴标记
                                    show: false,
                                    length: 10,
                                    lineStyle: {
                                        color: '#656668',
                                        type: 'solid',
                                        1
                                    }
                                },
                                axisLabel: {
                                    show: true,
                                    interval: 'auto',    // {number}
                                    //rotate: 45,
                                    margin: 8,
                                    //formatter: '{value}月',
                                    textStyle: {
                                        color: '#ffffff',
                                        fontFamily: 'sans-serif',
                                        fontSize: 10,
                                        fontStyle: 'italic',
                                        //fontWeight: 'bold'
                                    }
                                },
                                splitLine: {
                                    show: false,
                                    lineStyle: {
                                        color: '#656668',
                                        type: 'solid',
                                        1
                                    }
                                },
                                data: text,

                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                name: '浏览量',
                                axisLine: {    // 轴线
                                    show: true,
                                    lineStyle: {
                                        color: '#656668',
                                        type: 'solid',
                                        1
                                    }
                                },
                                axisLabel: {
                                    show: true,
                                    interval: 'auto',    // {number}
                                    //rotate: 45,
                                    margin: 8,
                                    //formatter: '{value}月',
                                    textStyle: {
                                        color: '#ffffff',
                                        fontFamily: 'sans-serif',
                                        fontSize: 10,
                                        fontStyle: 'italic',
                                        //fontWeight: 'bold'
                                    }
                                },
                                splitLine: {
                                    show: true,
                                    lineStyle: {
                                        color: '#656668',
                                        type: 'solid',
                                        1
                                    }
                                },
                            }
                        ],
                        series: [

                            {
                                name: '浏览量',
                                type: 'line',
                                itemStyle: {
                                    normal: {
                                        lineStyle: {            // 系列级个性化折线样式,横向渐变描边
                                            2,
                                            color: (function () {
                                                var zrColor = require('zrender/tool/color');
                                                return zrColor.getLinearGradient(
                                                    0, 0, 1000, 0,
                                                    [[0, 'rgba(255,0,0,0.8)'], [0.8, 'rgba(255,255,0,0.8)']]
                                                )
                                            })(),
                                            shadowColor: 'rgba(0,0,0,0.5)',
                                            shadowBlur: 10,
                                            shadowOffsetX: 8,
                                            shadowOffsetY: 8
                                        }
                                    },
                                    emphasis: {
                                        label: { show: true }
                                    }
                                },
                                data: value
                            }
                        ]
                    });

                }
            );
        }

  • 相关阅读:
    设计阶段如何画用例视图(UseCase View)
    如何进行博客中的摘要设计
    浅析Microsoft .net PetShop程序中的购物车和订单处理模块(Profile技术,异步MSMQ消息)<转>
    设计漂亮的样式表是一门艺术<轉>
    推荐几个Net开源项目
    使用Ajax和Jquery实现GridView的展开、合并
    36个引人注目JQuery导航菜单
    Nunit中如何进行事务性单元测试
    推荐Jquery 40个漂亮的导航菜单设计
    Highcharts:高交互性的javascript图表类库
  • 原文地址:https://www.cnblogs.com/myRain/p/6047070.html
Copyright © 2020-2023  润新知