Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在所有的图中,如果没有数据,怎么样可以在图表中间显示一句提示的话如:No Data Avaible #1040

Closed
kute opened this issue Dec 15, 2014 · 14 comments

Comments

@kute
Copy link

kute commented Dec 15, 2014

在所有的图中,如果没有数据,怎么样可以在图表中间显示一句提示的话如:No Data Avaible,

@kener
Copy link
Contributor

kener commented Dec 25, 2014

业务逻辑,判断无数据直接dom操作显示,没必要用图表,后续看是否需要加这个控制吧

kener added a commit that referenced this issue Dec 25, 2014
@kener kener closed this as completed Dec 25, 2014
@Seven0711
Copy link

请问新增的这个"noDataLoadingOption"怎么用呢?文档看不明白啊。

@kener
Copy link
Contributor

kener commented Feb 12, 2015

ec.init(
    dom, 
    {
       noDataLoadingOption:{...}
    }
)

@Seven0711
Copy link

谢谢,可以看到效果了。但是,noDataLoadingOption里的effect是不是只支持bubble、ring这两种类型啊,除了bubble,换成其他类型都会变成ring类型。

@kener
Copy link
Contributor

kener commented Feb 12, 2015

ec-m?主版本内置了所有特效,ec-m只有这两种,可以按需加载其他特效扩展。

@DualWield
Copy link

@Seven0711 能看一下noDataLoadingOption出现的demo吗?

@Seven0711
Copy link

@DualWield 以下就是我写的一个简单的例子:
require.config({
paths:{
echarts:'./js'
}
});
require(
[
'echarts',
'echarts/chart/bar'
],
function(ec,theme){
var myChart=ec.init(document.getElementById('main'),{
noDataLoadingOption:{
effect:'bar',
text:'没有数据。。。。。。',
textStyle:{
fontSize:40,
color:'red'
}
},
});

        var option = {
            tooltip : {
                trigger: 'axis'
            },
            toolbox: {
                show : true,
                feature : {
                    mark : {show: true},
                    dataView : {show: true, readOnly: false},
                    magicType : {show: true, type: ['line', 'bar']},
                    restore : {show: true},
                    saveAsImage : {show: true}
                }
            },
            legend: {
                data:['蒸发量','降水量']
            },
            xAxis : [
                {
                    type : 'category',
                    data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
                }
            ],
            yAxis : [
                {
                    type : 'value'
                }
            ],

            series : [
                {
                    name:'蒸发量',
                    type: 'bar',
                    data:[]//[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3]
                },
                {
                    name:'降水量',
                    type:'bar',
                    data:[]//[2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3]
                }
            ]
        };
        myChart.setOption(option);
    });

@DualWield
Copy link

@kener 不知道算不算bug,如果你先showLoading() ,等数据加载完毕,再setOption,再hideLoading,如果没有数据的话,noDataLoadingOption的样式不会出来

@pissang
Copy link
Contributor

pissang commented Jul 28, 2015

先 hideLoading 再 setOption

@DualWield
Copy link

@pissang 谢沈大哥~

@LitterRoach
Copy link

@Seven0711 我现在有个问题,如果我setTheme了,就会导致noDataLoadingOption样式出不来

@hknakata
Copy link

hknakata commented Nov 2, 2015

那在theme上配置就好了

   var noDataLoadingOption = {
    text: 'Chat\nUnavailable',
    textStyle: {
        color:'#000',
        fontSize: '18'
    },
    effect: 'bubble'
};

var shineTheme;

require(['echarts/theme/shine'], function(tarTheme){
    shineTheme = tarTheme;
    shineTheme.noDataLoadingOption = noDataLoadingOption;
});

   var handledPie = ec.init(document.getElementById('handled-pie'), shineTheme);
   handledPie.setOption(handledPieOption);

good luck!!!

@henussf
Copy link

henussf commented Nov 10, 2015

请问怎么把没有数据时的气泡给关闭啊。

@hknakata
Copy link

直接把有关div hidden就好了,哈哈哈

兄弟,别想太多,一切从简

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants