nvd3.js - AngularJs Nvd3 Charts -
hi community, struck few past days..i tried nvd3 master in github.then played lineplusbarfocuschart.i have 1 issue,in example,they had used numeric values..for info load
var testdata = [ { "key" : "quantity" , "bar": true, "values" : [ [ "egg" , 121000.0] , [ 1138683600000 , 127000.0] ] }, { "key" : "price" , "values" : [ [ "egg" , 71.89] , [ 1138683600000 , 75.51] ] } ]
while alter first value string..my chart looks this,
can help me finish issue....reply appreciated.
regards, yuvaraj...
each info element series sequential element, need have time variable. can add together additional variable labels dataset
$scope.data = [ { "key" : "quantity" , "bar": true, "values" : [ [ 1136005200000 , 1271000.0, 'egg1'] , [ 1138683600000 , 1271000.0, 'egg2'] , ... ] },{ "key" : "price" , "values" : [ [ 1136005200000 , 71.89], ... ] } ].map(function(series) { series.values = series.values.map(function(d) { homecoming {x: d[0], y: d[1], label: d[2] } }); homecoming series; });
and manipulate xaxis.tickformat
chart option. alternative can defined function like:
xaxis: { tickformat: function(d) { var dx = $scope.data[0].values[d].x; var label = $scope.data[0].values[d].label; homecoming label ? label : d3.time.format('%x')(new date(dx)); } }
see demo. (it uses this directive here.)
angularjs-directive nvd3.js
No comments:
Post a Comment