问题
working with discreteBarChart in nvd3 here is the basic example in jsfiddle
I have created this bar chart and I have got my data that feeds it to look like this as is required:
var data = [
{
key: "KPI_NAME",
values: [
{
"label" : "A" ,
"value" : -29.765957771107,
"series" : 0
} ,
{
"label" : "B" ,
"value" : 0,
"series" : 0
} ,
{
"label" : "C" ,
"value" : 32.807804682612,
"series" : 0
} ,
{
"label" : "D" ,
"value" : 196.45946739256,
"series" : 0
} ,
{
"label" : "E" ,
"value" : 0.19434030906893,
"series" : 0
} ,
{
"label" : "F" ,
"value" : -98.079782601442,
"series" : 0
} ,
{
"label" : "G" ,
"value" : -13.925743130903,
"series" : 0
} ,
{
"label" : "H" ,
"value" : -5.138732287,
"series" : 0
}
]
}
]
see the jsfiddle example -> this is with the series added "series: 0" to my data object. This is just how I am creating my object and does not affect the graph.
now i have added another series to my data feed and what i am trying to do is have a constant line in the graph but i get the following in this example(this is with the second series added in my data object)
Is there away I can get the second series to be a line so I would have a constant line accross the top with value 98?
Note: My data that feeds this graph could possibly be formatted better but I am just try to reuse what I already have.
来源:https://stackoverflow.com/questions/22391330/nvd3-discretebarchart-add-a-line-to-chart