search

Home  >  Q&A  >  body text

php - How to set this distance in Baidu echarts2.x, cannot be found

How to set the distance between the legend and the chart
The title is farther away from the chart. I read the manual several times and can't find it! ! !

Code


                var option = {
    tooltip : {
        trigger: 'axis'
    },
    grid : {
        top: 300
    },
    legend: {
        data:['baidu','google','sm','sogou','so','yesterday_str','count'],
        textStyle: {
           fontSize: 30 // Use legend.textStyle.fontSize to change the example size
        },
        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: 'Total amount',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: 'Total',data:[ 2225,2400,2343,2292,2540,1734,2242,2436,110,134,]}, {name:'google' ,type:'line',line: 'Total amount',data:[ 1155,1150,1172,1160,1163,1154,1152,1135,10,112,]}, {name:'sm',type:'line',line: 'Total',data:[ 1201,1209,1236,1216,1240,1244,1240,1290,1750,1980,]}, {name:'sogou',type:'line',line: 'Total',data:[ 1150,1180,1221,1238,1231,1253,1226,173,10,13,]}, {name:'so',type:'line',line: 'Total',data:[ 513,534,565,593,575,732,792,750,729,685,]} , {name:'count',type:'line',line: 'total',data:[ 1634,1843,1877,1809,2079,2287,1762,1634,1750,1349,]}, ]
};
                window.onresize = function(){
                myChart.resize();
            };
                //Load data for the echarts object
                myChart.setOption(option);
曾经蜡笔没有小新曾经蜡笔没有小新2753 days ago402

reply all(3)I'll reply

  • 阿神

    阿神2017-05-16 13:08:31

    1. It’s best to refer to the official documentation, don’t look for other tutorials, they will be out of date: http://echarts.baidu.com/opti...

    2. Echarts option can be modified to

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

    4. You can try configuring it in this example, address: http://echarts.baidu.com/demo...

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-05-16 13:08:31

    Go to the official documentation and look at the detailed configuration manual. If there is this option, it will be easier. If not, just change the style yourself

    reply
    0
  • 黄舟

    黄舟2017-05-16 13:08:31

    grid.top

    reply
    0
  • Cancelreply