question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to display "No Data" message on echart

See original GitHub issue

How we can display No Data message on echart?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
larrykkkcommented, Sep 25, 2019

use the data.length to control Echart option

title: {
    show: answerCountArr.length === 0,
    textStyle: {
        color: "grey",
        fontSize: 20
    },
    text: "No data",
    left: "center",
    top: "center"
},
xAxis: {
    show: answerCountArr.length,
    //...
},
yAxis: {
    show: answerCountArr.length,
    //...
},

if data.length is false then chart will only show “No data”

8reactions
tongxuehellocommented, Sep 9, 2017

@coskuntekin I solved this problem by this way: clear echarts instance first, then setOption with custom title option (without series data and hide axis line). By the way, you can add background to the option.

    var showChartInfo = function (divId, infoStr) {
        var msgOption = {
            title: {
                show: true,
                textStyle:{
                  color:'grey',
                  fontSize:20
                },
                text: infoStr,
                left: 'center',
                top: 'center'
              },
            xAxis: {
                show: false
            },
            yAxis: {
                show: false
            },
            series: []
        };
        initChart(divId).clear() //initChart(divId): get echarts instance, you can get it by using other method
        initChart(divId).hideLoading()
        initChart(divId).setOption(msgOption)
    };
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to display "No Data" message on echart - The Mail Archive
... a comment on issue #5833: How to display "No Data" message on echart ... use the data.length to control Echart option ```...
Read more >
How to display "No Data" message in the middle of chart area ...
I am using ng-google-charts.js library to display a column chart. If we have data ...
Read more >
5.2 - What's New - Basics - Handbook - Apache ECharts
To solve this problem, in this version we will default to display a gray placeholder circle when there is no data to prevent...
Read more >
Display "No data" message on donut chart when datasource is ...
So if the datasource is empty, the chart area appears blank. We are looking to display some message to the UI such as...
Read more >
Visualization: Pie Chart - Google Developers
See Customizing Tooltip Content for more details. Note: customization of the HTML tooltip content via the tooltip column data role is not supported...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found