EChart 标题 title 样式,x轴、y轴坐标显示,调整图表位置等

示例里工作一般情况是够用了,更复杂的可以查询教程:

title 官方解说:http://echarts.baidu.com/option.html#title

坐标相关: X轴:http://echarts.baidu.com/option.html#xAxis

坐标相关: Y轴:http://echarts.baidu.com/option.html#yAxis

表格部分:http://echarts.baidu.com/option.html#grid

<script>
    function getChartsLine() {

        var myChart = echarts.init(document.getElementById(‘progress‘),‘macarons‘);

        var option = {
            title: {
                text: ‘工程折线图‘,      //主标题
                textStyle:{
                    color:‘#0DB9F2‘,        //颜色
                    fontStyle:‘normal‘,     //风格
                    fontWeight:‘normal‘,    //粗细
                    fontFamily:‘Microsoft yahei‘,   //字体
                    fontSize:14,     //大小
                    align:‘center‘   //水平对齐
                },
                subtext:‘副标题‘,      //副标题
                subtextStyle:{          //对应样式
                    color:‘#F27CDE‘,
                    fontSize:14
                },
                itemGap:7
            },
            grid:{          //显示数据的图表位于当前canvas的坐标轴
                x:50,
                y:55,
                x2:50,
                y2:60,
                borderWidth:1
            },
            tooltip: {
                trigger: ‘axis‘
            },
            legend: {
                data:["计划完成","实际完成"]
            },
            toolbox: {
                show: true,
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis:  {
                type: ‘category‘,
                boundaryGap: false,
                data: ["2015-1", "2015-2", "2015-3", "2015-4", "2015-5", "2015-6", "2015-7", "2015-8", "2015-9", "2015-10", "2015-11", "2015-12"]
            },
            yAxis: {
                type: ‘value‘,

                //默认以千分位显示,不想用的可以在这加一段
                axisLabel : {   //调整左侧Y轴刻度, 直接按对应数据显示
                    show:true,
                    showMinLabel:true,
                    showMaxLabel:true,
                    formatter: function (value) {
                        return value;
                    }
                }
            },
            series: [
                {
                    name:"计划",
                    type:‘line‘,
                    data: [2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 300, 2.3],
                    markPoint: {
                        data: [
                            {type: ‘max‘, name: ‘最大值‘},
                            {type: ‘min‘, name: ‘最小值‘}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: ‘average‘, name: ‘平均值‘},
                            [{
                                symbol: ‘none‘,
                                x: ‘90%‘,
                                yAxis: ‘max‘
                            }, {
                                symbol: ‘circle‘,
                                label: {
                                    normal: {
                                        position: ‘start‘,
                                        formatter: ‘最大值‘
                                    }
                                },
                                type: ‘max‘,
                                name: ‘最高点‘
                            }]
                        ]
                    }
                },
                {
                    name:"实际",
                    type:‘line‘,
                    data:[0, 0, 37, 0, 0, 15, 3036, 5572, 0, 0, 0, 0],
                    markPoint: {
                        data: [
                            {type: ‘max‘, name: ‘最大值‘},
                            {type: ‘min‘, name: ‘最小值‘}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: ‘average‘, name: ‘平均值‘},
                            [{
                                symbol: ‘none‘,
                                x: ‘90%‘,
                                yAxis: ‘max‘
                            }, {
                                symbol: ‘circle‘,
                                label: {
                                    normal: {
                                        position: ‘start‘,
                                        formatter: ‘最大值‘
                                    }
                                },
                                type: ‘max‘,
                                name: ‘最高点‘
                            }]
                        ]
                    }
                }
            ]
        };
        myChart.setOption(option);
    }

    getChartsLine();
</script>

修改后:

原文地址:https://www.cnblogs.com/shuilangyizu/p/11566726.html

时间: 2024-07-28 18:23:12

EChart 标题 title 样式,x轴、y轴坐标显示,调整图表位置等的相关文章

echarts-去掉X轴 Y轴和网格线

1.问题背景 如何在echarts中,去掉X轴.Y轴和网格线,只留数据图形 2.实现源码 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>echarts-去掉X轴.Y轴和网格线</title> <link rel="shortcut icon" href="../js/echarts-2.2.7/doc/as

PhoneGap 加速计 api 获取加速计 x 轴 y 轴 z 轴信息

一.PhoneGap 加速计 Accelerometer 对象介绍 1.主要方法 accelerometer.getCurrentAcceleration 获取当前设备在 x,y,z 轴上的加速度信息 accelerometer.watchAcceleration       定期获取设备的加速度信息 accelerometer.clearWatch      停止定期获取设备的加速度信息 2.参数 accelerometerSuccess 获取加速度信息成功的回调函数 acceleromete

绕X 轴 Y轴 Z轴旋转的结果

void warp_perspect_3_angle(cv::Mat face, float roll, float yaw, float pitch) { cv::Mat face_img = face.clone(); int imgHeight = face_img.rows; int imgWidth = face_img.cols; float alpha, beta, gamma; alpha = pitch * 3.1415926 / 180; beta = yaw* 3.1415

使用flot.js 发现x轴y轴无法显示轴名称

添加此插件解决问题 flot-axislabels https://github.com/markrcote/flot-axislabels

多Y轴示例

//多Y轴示例 <template> <div id="main" :style="{width:'1000px',height:'500px' }"></div> </template> <script> export default { name: "demo10", data() { return {}; }, mounted() { app.title = "多 Y 轴

echart折线堆叠图 Y轴数据不堆叠

<!DOCTYPE html> <html> <head></head> <body>     <div class="row form-inline form-ranking">     <div class="form-group">         <label class="control-label">店铺:</label>   

Analyzer使用第二Y轴,以及同一分析图不同量值使用不同的图形样式

Analyzer的建立分析图后,图中有两个量值,希望能显示成不同的图形样式,如一个是柱图.一个是线图. 1.设置显示多个量值: 3.设置显示出图例,即表明图中量值内容的说明: 2.右键图例中要修改为不同的样式的维度名称的前边的图形,可以出现4类不同的图形名称:柱图.折线图.面积图和点图:还有一个选择是第二Y轴: 3.选中后,整个图形就会完成设置: 注意:只有在柱形图.折线图.面积区域图.点图才有不同的图形样式,像饼图这些是没有其他样式的

[DevExpress]ChartControl之创建X,Y轴Title示例

关键代码: /// <summary> /// 设置X轴Title /// </summary> /// <param name="chart">ChartControl</param> /// <param name="titleText">Title文字</param> /// <param name="titleColor">Title文字颜色</pa

Highcharts属性与Y轴数据值刻度显示Y轴最小最大值

Highcharts 官网:https://www.hcharts.cn/demo/highcharts Highcharts API文档:https://api.hcharts.cn/highcharts#yAxis.tickmarkPlacement Highcharts属性与Y轴数据值刻度显示Y轴最小最大值 Highcharts.setOptions({global:{useUTC : false}}); $(function(){ //声明报表对象 var chart = new Hig