sameer
sameer

Reputation: 447

Chart DATA ZOOM Cannot read property 'length' of undefined

I want to display Data Zoom as Date value instead of category data value so that I added two axis.

Please look @ my below java script code :

option = {
    dataZoom: {
        show: true,
        realtime : true,
        xAxisIndex: [1],
    },
    xAxis : [{
        type: 'category',
        data: ['A','B','C']
    },{
        type: 'value',
        xAxisIndex: 1,
        yAxisIndex: 1,
        formatter: function(value) {
            var dateObj= new Date(value);
            return dateObj.format("yyyy-mm-dd HH:MM:ss");                                                     
        }
    }
}

Upvotes: 1

Views: 136

Answers (1)

Kiya
Kiya

Reputation: 168

here series: [data] is missing.

add series in option as follows and try.

series: [
  {
    name: 'Active Minutes',
    type: 'pie',
    radius: '55%',
    center: ['45%', '65%'],
    data: [
      { value: jsondata.avgSedentaryTime, name: 'Sedentary' },
      { value: jsondata.avgFairlyActiveTime, name: 'Fairly Active' },
      { value: jsondata.avgLightlyActive, name: 'Lightly Active' },
      { value: jsondata.avgVeryActive, name: 'Very Active' }
    ],
    itemStyle: {
      emphasis: {
        shadowBlur: 10,
        shadowOffsetX: 0,
        shadowColor: 'rgba(0, 0, 0, 0.5)'
      }
    }
  }
]

Upvotes: 1

Related Questions