echarts icon indicating copy to clipboard operation
echarts copied to clipboard

3.0 x轴为time类型的线形图,切换成柱状图无法显示。

Open chenguo367 opened this issue 10 years ago • 7 comments

option = {
    title : {
        text : '时间坐标折线图',
        subtext : 'dataZoom支持'
    },
    tooltip : {
        trigger: 'axis',
        formatter : function (params) {
            var date = new Date(params.value[0]);
            data = date.getFullYear() + '-'
                   + (date.getMonth() + 1) + '-'
                   + date.getDate() + ' '
                   + date.getHours() + ':'
                   + date.getMinutes();
            return data + '
' + params.value[1] + ', ' + params.value[2]; } }, toolbox: { show : true, feature : { mark : {show: true}, dataView : {show: true, readOnly: false}, restore : {show: true}, "magicType": { "show": true, "type": ["line", "bar"] }, saveAsImage : {show: true} } }, legend : { data : ['series1'] }, grid: { y2: 80 }, xAxis : [ { type : 'time', splitNumber:10 } ], yAxis : [ { type : 'value' } ], series : [ { name: 'series1', type: 'line', showAllSymbol: true, symbolSize: function (value){ return Math.round(value[2]/10) + 2; }, data: (function () { var d = []; var len = 0; var now = new Date(); var value; while (len++ < 5) { d.push([ new Date(2014, 9, 1, 0, len * 10000), (Math.random()*30).toFixed(2) - 0, (Math.random()*100).toFixed(2) - 0 ]); } return d; })() } ] };

chenguo367 avatar Jan 23 '16 09:01 chenguo367

qq 20160123172350

chenguo367 avatar Jan 23 '16 09:01 chenguo367

@chenguo367 我看你直接拿的echarts2版本的例子,3.x版本你的option的tooltip应该出不来吧,我看formatter里参数是一个array。不过3.x版本的magicType确实有问题。

PS:2.x版本切换到柱状图的时候,出现下面的绘制情况。 a

SuperZDev avatar Jan 23 '16 12:01 SuperZDev

对,3.x下面 formatter的参数是一个array了。期待magicType 的修复

chenguo367 avatar Jan 24 '16 07:01 chenguo367

柱状图暂时还不支持 Time 类型的轴

pissang avatar Jan 25 '16 03:01 pissang

时间轴支持柱状图还是很常见的需求,不应该仅仅是一个enhancement

wangjiaji avatar Feb 14 '16 04:02 wangjiaji

+1 for time series histogram support. Echarts 3 looks great but most of our data is time-series and make extensive use of the time series histogram in 2.x. Therefore, I'm unable to move to v3.

jverghese avatar Feb 18 '16 02:02 jverghese

Added time axis support in 3.2.2

pissang avatar Jul 13 '16 06:07 pissang