php - 百度echarts2.x這個距離怎麼設置,找不到
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-16 13:06:31
0
3
425

怎麼設定legend與圖表之間距離遠一點
就是標題跟圖表距離遠一點,看了好幾遍手冊,找不到! ! !

代碼


                var option = {
    tooltip : {
        trigger: 'axis'
    },
    grid : {
        top : 300
    },
    legend: {
        data:['baidu','google','sm','sogou','so','yesterday_str','count'],
        textStyle: {
           fontSize: 30 // 用 legend.textStyle.fontSize 更改示例大小
        },
        itemWidth: 30,
        itemHeight: 30
    },
    toolbox: {
        show : false,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            axisLabel: {
            rotate: 0,
            interval: 0,
            textStyle:{
            fontSize:20
            }
            },
            type : 'category',
            boundaryGap : false,

            data : ['2017-04-18','2017-04-19','2017-04-20','2017-04-21','2017-04-22','2017-04-23','2017-04-24','2017-04-25','2017-04-26','2017-04-27',]        }
    ],
      yAxis : [
        {
            type : 'value',
            axisLabel : {
                formatter: '{value}',
                textStyle: {
                fontSize: 20
                }
            }
        }
    ],
    series : [
         {name:'yesterday_str',type:'line',line: '总量',data:[ 2017-04-18,2017-04-19,2017-04-20,2017-04-21,2017-04-22,2017-04-23,2017-04-24,2017-04-25,2017-04-26,2017-04-27,]}, {name:'baidu',type:'line',line: '总量',data:[ 2225,2400,2343,2292,2540,1734,2242,2436,110,134,]}, {name:'google',type:'line',line: '总量',data:[ 1155,1150,1172,1160,1163,1154,1152,1135,10,112,]}, {name:'sm',type:'line',line: '总量',data:[ 1201,1209,1236,1216,1240,1244,1240,1290,1750,1980,]}, {name:'sogou',type:'line',line: '总量',data:[ 1150,1180,1221,1238,1231,1253,1226,173,10,13,]}, {name:'so',type:'line',line: '总量',data:[ 513,534,565,593,575,732,792,750,729,685,]}, {name:'count',type:'line',line: '总量',data:[ 1634,1843,1877,1809,2079,2287,1762,1634,1750,1349,]},    ]
};
                window.onresize = function(){
                myChart.resize();
            };
                // 为echarts对象加载数据
                myChart.setOption(option);
曾经蜡笔没有小新
曾经蜡笔没有小新

全部回覆(3)
阿神
  1. 參照官方文件最好, 不要找別的教程, 會過時: http://echarts.baidu.com/opti...

  2. echarts 的option中修改就成了

  3. 3.x版本为top 或者y; 2.x版本为y

  4. 你可以在這個例子裡面配置一下試試, 地址:http://echarts.baidu.com/demo...

仅有的幸福

去官方的文檔看看詳細配置手冊,如果有這個 option 的話就好辦了,沒有就自己改樣式吧

黄舟

grid.top

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板