arashdalir commented on issue #9341: events defined by `chart.on(eventName, 
...` are not triggered
URL: 
https://github.com/apache/incubator-echarts/issues/9341#issuecomment-436189396
 
 
   found the issue. there is a problem with triggering the events when the 
dataset is empty. if there is no data to be rendered, the events are not 
triggered. it is not dependant on the `onload` function, but rather the `data` 
of the series; which is a big inconevience. 
   
   there is also another problem with mouse-events; they ONLY WORK if users 
click on series, but not on the chart itself. I assume the triggers are defined 
on the wrong subjects. please check out the commented series in following 
example:
   
   ```javascript
   
   console.log('started loading');
   
   var myChart = echarts.init(document.getElementById('chart1'), null, {
        "devicePixelRatio": null,
        "renderer": "canvas",
        "width": null,
        "height": "600px"
   });
   myChart.setOption({
        "title": {
                "text": "test",
        },
        "grid": [
                {
                        "top": "5%",
                        "height": "60%",
                        "width": "60%",
                        "left": "5%",
                        "containLabel": false,
                        "borderColor": "transparent",
                        "show": "1"
                }
        ],
        "xAxis": [
                {
                        "type": "category",
                        "min": "dataMin",
                        "max": "dataMax"
                }
        ],
        "yAxis": [
                {
                        "type": "value",
                }
        ],
        // "series": {"name": "insufficient_data", "type": "bar", "data": [[1, 
2], [2, 3]]}, // this works
        // "series": {"name": "insufficient_data", "type": "bar", "data": []}, 
// this doesn't work
        // "series": {"name": "insufficient_data", "type": "bar"}, // this 
neither
   });
   
   console.log('options set');
   
   myChart.on('finished', function (params){
        console.log('finished loading');
   });
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to