score:2
For your purpose you can try angular-nvd3 directive.
You should just set up chart options
and chart data
as json, something like
//html
<nvd3 options="options" data="data"></nvd3>
//javascript, controller
$scope.options = {
chart: {
type: 'discreteBarChart',
height: 450,
x: function(d){return d.label;},
y: function(d){return d.value;},
showValues: true,
valueFormat: function(d){
return d3.format(',.2f')(d);
},
transitionDuration: 500,
xAxis: {
axisLabel: 'Month',
rotateLabels: -20
},
yAxis: {
axisLabel: 'Revenue',
axisLabelDistance: 30
}
}
}
$scope.data = [{
values: [{
"label" : "Jan" ,
"value" : 29.765957771107
},{
"label" : "Feb" ,
"value" : 20
},{
...
}]
}]
See live demo
Source: stackoverflow.com
Related Query
- how to draw nvd3 simple barchart with x and y axis in angularjs
- How to draw logarithmic line charts with nvd3
- With D3, how can I set attribute ("fill", "none") of axis path and line, but not text (without editing stylesheet)
- Draw a map with D3.js: How to get the right scale() and translate()?
- d3.js, how can i create an axis with custom labels and customs ticks?
- How to draw D3 Map with United States, Canada, Mexico and Puerto Rico
- How to draw a rectangle with d3.js based on 2 diametrical points and no length or height values?
- NVD3 Logarithmic Y axis with barchart
- How to create left axis with variable tick interval in tick values and has same distance between tick value
- D3.js V4 : How to create X axis with time and %H:%M:%S format
- How to align x axis with bars respectively in Combo Chart (Bars and Lines)?
- d3.js How to draw line chart with vertical x axis labels
- Show values on Y Axis as it is with Higher and lower limits NVD3 Line Chart
- How can I create a basic bar chart with unique counts on the y axis and a category on the x axis?
- d3.js How to draw a directed graph with one node start and one node end
- How to plot D3 barchart with months/Year on x axis with days as spacing between months
- Creating dynamic barchart with D3js and Angularjs
- Add a space between the axis and text with NVD3 charts
- How to use nvd3 indentedTree with AngularJS
- How to force d3's date axis to draw ticks for first and last months that are not full [FIDDLE UPDATED]?
- How to draw a stack of rectangles with a predefined start position and margin level in d3
- How do I draw gridlines in d3.js with zoom and pan
- Using NvD3 charts, how to get x axis and Y axis label for multichart?
- nvd3 - how to draw a line over a scatterPlusLineChart, with specific cordinates
- How to draw a Bar Chart with time on xAxis and one or more numeric data for yAxis in d3js?
- How do I remove all children elements from a node and then apply them again with different color and size?
- How do I save/export an SVG file after creating an SVG with D3.js (IE, safari and chrome)?
- Draw simple timeline with D3
- How can I get the D3.js axis ticks and positions as an array?
- How to draw straight line in d3.js (horizontally and vertically)
More Query from same tag
- Simple D3 demo not working with altered structure
- Element ID not available till navigating to DOM
- Ionic Framework Typescript: Callback function is not able to access `this` variables
- Nested plot and line graph in d3
- d3 - apply transformations to different elements when dragging
- d3js column bar chart height error
- Creating a whole new world with shapefile format of different layers in one file
- Performance of nvd3 for a lot of data
- How to create stretchable svg shapes
- How do you make an SVG element mouse event bubble up through another element?
- d3: Avoid unchanged nodes?
- D3 x-axis format based on zoom level
- Webpack 2 Not Tree Shaking D3.js Properly
- Need Help Refactoring My Javascript Code (D3)
- Preventing Text-Clipping in D3 (Javascript Charting)
- Is it possible to change the size of a foreignObject after it is created?
- (d3.js) How to create labels outside arcs?
- D3 adding force to single node
- Dart JS Interop Function overloading for typing
- In p5.js clear elements in draw() that change every frame, but leave expensive element (a map) created in setup()
- D3 Programmatic rotation of radial Graph
- How to implement asynchronous inside d3
- Updating and Transitioning Individual SVG Elements Within a Group in D3.js
- How to properly assign separate colors to different lines and line series in D3 Dimple?
- D3js zoom with reset function
- D3: issue with legend scaling
- D3.js: Is there a way to cap a "displayed" value at an axis max/min while retaining the "actual" value for a tooltip display?
- How can I perform this d3.js magic (Grouped Bar Chart) with JSON rather than CSV?
- D3.js: Accessing Object Property inside Array for Creating Line Graph
- How to make dynamic graph with rickshaw without refreshing the browser?