custom no data label in nvd3 scatter chart
Asked Answered
T

2

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?

Townsend answered 10/5, 2014 at 14:32 Comment(0)
M
17

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

chart.noData("Nothing to see here.");
Milone answered 10/5, 2014 at 14:38 Comment(4)
Is there any way we can change the color as well ?Charlettecharley
Of the string? You can select the element and change it directly.Milone
Thanks for the comment. I have tried this but its not taking color value, however text-decoration works fine. text.nvd3.nv-noData{ color:"yellow"; text-decoration: underline; }Charlettecharley
You might want to post a separate question about this.Milone
K
8

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

Kemper answered 11/2, 2016 at 11:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.