NVD3 Distinct Bar with "Duplicate Labels"

Explanations on our Table of Decals are user names. The problem is that there may be several users with the same name.

I want the x axis to be different from the user ID, but I would like the label to be the username (yes, I understand that the name is ambiguous, but this is normal for our purposes)

Given the following data, how to get the x axis to be different in id, but display the label value

[{ "key" : "tester", "values" : [{ "value" : 5.0, "label" : "John Smith", "color" : "#9BA474", "id" : 1388 }, { "value" : 10.25, "label" : "Jane D'oh", "color" : "#356AA0", "id" : 11 }, { "value" : 3.5, "label" : "John Smith", "color" : "red", "id" : 12 }] }] 
+4
source share
1 answer

I may have an answer to my question. If there are other ways to do this, I would like to hear them.

 var chart = nv.models.discreteBarChart() .x(function(d, i) { return i }) .y(function(d) { return d.value }); chart.xAxis .tickFormat(function(d) {return data[0].values[d].label; }); 
+1
source

Source: https://habr.com/ru/post/1497802/


All Articles