custom no data label in nvd3 scatter chart

时光怂恿深爱的人放手 提交于 2019-12-22 02:21:13

问题


I am trying to have custom message instead of the "No Data Available" message which is displayed. I am using nvd3 scatter / bubble chart. I came across a suggestion here

data2 = [ 
  { 
  "key" : "A key" , 
  "values" : [[]]
  }
];

but I want to change the message. I looked at the source scatter.js but did not find "No Data Available" message. Do I need to modify another source file? How can I do so?


回答1:


Looking at the source, it seems that you can set the message using .noData():

chart.noData("Nothing to see here.");



回答2:


If you happen to use the Angular NVD3 wrapper, the way to set the custom message is through chart options, simply:

$scope.options = {
    chart: {
      ...
      noData: 'Your custom message',
      ...
    }
  };

I have prepared a simple demo plunker: http://plnkr.co/edit/hORaQh?p=preview



来源:https://stackoverflow.com/questions/23582292/custom-no-data-label-in-nvd3-scatter-chart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!