0

I´m using angularjs-nvd3-directives for display a chart line, but I need to display datasets that have more than one set of values for the same key. For example:

"key": "estimation"
"values": actual: [[x1,a1],[x2,a2]...]
          deviation: [[x1,d1],[x2,d2]...]

I have an example in plunker http://plnkr.co/edit/RM0iUx?p=preview but it does not render two lines at the same time.

Is this posible to achieve with nvd3-directives? Has anybody done something similar?

I need the two lines, sets of data values, to be associated with the same key. So when I click on legend corresponding to that key both lines should be affected

lau B
  • 1
  • 1

1 Answers1

0

it's because you have two sets with the same name "set", just change the names to be different from each other and it will be solved.

$scope.exampleData = [
    {
      "key": "set1",
      "values":[[0, 0],   [1, 1],  [2, 2],   [3, 3]]
    },
    {
      "key":"set2",
      "values":[[1,0.5],[2,1.5],[2,2.5],[3,2.5]]
    }

    ];
Seichi
  • 273
  • 4
  • 11
  • Thanks Seichi for your answer, but indeed i need the two lines, sets of data values, to be associated with the same key. So when I click on legend corresponding to that key both lines should be affected – lau B Jul 01 '15 at 17:14
  • my bad, I read the docs and i can't find such thing. The only solution i can think about is to put something like `key: "actual"` and `key :"deviation"` on the other but still two different sets. – Seichi Jul 01 '15 at 18:48
  • yes, I agree. I should implement legend function instead of using it through nvd3-directive. Thanks again! – lau B Jul 01 '15 at 19:09