Giter Club home page Giter Club logo

ng-nvd3's Introduction

##AngularJS directive for nvd3.js charts This is a lightweight directive for nvd3 AngularJS with built in support for building responsive and custom styled graphs/charts. It currently supports pie chart, line chart, scatter chart, bar chart(both horizontal and vertical) and line-plus-bar graph with more charts on the way.

###Project Project page at: http://sattarab.github.io/ng-nvd3

###Basic Setup Using bower: bower install ng-nvd3 --save

Note: This directive module is dependent on angular, d3 and nvd3
1. Install the directive using bower install ng-nvd3 --save
2. This would add install the dependencies required for this directive and the directive itself
3. Include the dependencies in the <head> tag of the html document. For example
  <link rel="stylesheet" href="bower_components/nvd3/nv.d3.css"/>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
  <script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
  <script src="bower_components/nvd3/nv.d3.js"></script>
  <script src="bower_components/angularjs-nvd3-directives/dist/angularjs-nvd3-directives.js"></script>
4. Add the dependency of the directive in the angular app

  Note: I have added d3.v3.min.js as a direct link in the script tag above. You can either download the d3.v3.js from this repository provided in lib folder or use the direct link as shown above

###API ####Pie Chart Pie Chart #####How to use?

**Angular-directive in html:**
<nvd3-pie-chart ...></nvd3-pie-chart>

Important Note: Setting specific values for width or height in div-class would not make the graph responsive anymore.

Attributes:

chartId(recommended): The unique id of the pie chart on that page. It is required if there are multiple pie charts on the same html page.
colors(optional): For custom color you can provide color as an array of hex or rgb values.
data(required): The data that is to be displayed on the pie chart.
div-class(optional): For custom styling of the div that would contain the chart. If the div-class contains the specific values for width and height of the graph this would override the responsive property even if the property is set to true.
donut(optional): If provided and is true the output graph would be a donut pie chart.
duration(optional): The transition duration. The default value is 250.
half(optional): If provided and is true the output graph is halved.
height(required): The height of the output graph.
hideLegend(optional): If provided and is true the output graph does not have a legend.
responsive(optional): If provided and is true the output graph is responsive.
width(optional): The width of the output graph.

####Line Graph Line Chart #####How to use?

**Angular-directive in html:**
<nvd3-line-graph ...></nvd3-line-graph>

Important Note: Setting specific values for width or height in div-class would not make the graph responsive anymore.

Attributes:

chartId(recommended): The unique id of the line chart on that page. It is required if there are multiple line charts on the same html page.
data(required): The data that is to be displayed on the line chart.
div-class(optional): For custom styling of the div that would contain the chart. This can be used for setting the width and height of the div that contains the line chart.
duration(optional): The transition duration. The default value is 250.
guide(optional): If provided and is true the output graph does have a legend.
height(required): The height of the output graph.
responsive(optional): If provided and is true the output graph is responsive.
width(optional): The width of the output graph.
xlabel(optional): The x-axis label of the graph.
xformat(optional): The format of data on the x-axis.
ylabel(optional): The y-axis label of the graph.
yformat(optional): The format of data on the y-axis.

####Scatter Graph #####How to use?

**Angular-directive in html:**
<nvd3-scatter-graph ...></nvd3-scatter-graph>

Important Note: Setting specific values for width or height in div-class would not make the graph responsive anymore.

Attributes:

chartId(recommended): The unique id of the scatter chart on that page. It is required if there are multiple scatter charts on the same html page.
data(required): The data that is to be displayed on the scatter chart.
div-class(optional): For custom styling of the div that would contain the chart. This can be used for setting the width and height of the div that contains the scatter chart.
duration(optional): The transition duration. The default value is 250.
forceLine(optional): If provided and is true a line is drawn through the points on the scatter plot.
height(required): The height of the output graph.
responsive(optional): If provided and is true the graph is responsive.
width(optional): The width of the output graph.
xformat(optional): The format of data on the x-axis.
yformat(optional): The format of data on the y-axis.

####Bar Graph Bar Chart #####How to use?

**Angular-directive in html:**
<nvd3-bar-graph ...></nvd3-bar-graph>

Important Note: Setting specific values for width or height in div-class would not make the graph responsive anymore.

Attributes:

chartId(recommended): The unique id of the chart on that page. It is required if there are multiple charts on the same html page.
data(required): The data that is to be displayed on the chart.
div-class(optional): For custom styling of the div that would contain the chart. This can be used for setting the width and height of the div that contains the horizontal bar chart.
duration(optional): The transition duration. The default value is 250.
height(required): The height of the output graph.
horizontal(optional): Default false.If provided and is true the resultant output graph is a horizontal bar graph.
responsive(optional): If provided and is true the output graph is responsive.
showControls(optional): If provided and true it would show controls for the graph.
showValues(optional): If provided and true it would show values on the graph.
tooltips(optional): If provided and true it would show tooltip when the values are hovered on the graph.
width(optional): The width of the output graph.
yformat(optional): The format of data on the y-axis.

####Line Plus Bar Graph Line Plus Bar Graph #####How to use?

**Angular-directive in html:**
<nvd3-line-plus-bar-graph ...></nvd3-line-plus-bar-graph>

Important Note: Setting specific values for width or height in div-class would not make the graph responsive anymore.

Attributes:

chartId(recommended): The unique id of the chart on that page. It is required if there are multiple charts on the same html page.
data(required): The data that is to be displayed on the chart.
div-class(optional): For custom styling of the div that would contain the chart. This can be used for setting the width and height of the div that contains the horizontal bar chart.
duration(optional): The transition duration. The default value is 250.
height(required): The height of the output graph.
responsive(optional): If provided and is true the output graph is responsive.
width(optional): The width of the output graph.
xformat(optional): The format of data on the x-axis.
xlabel(optional): The x-axis label of the graph.
y1format(optional): The format of data on the y1-axis.
y2format(optional): The format of data on the y2-axis.
y1label(optional): The y1-axis label of the graph.
y2label(optional): The y2-axis label of the graph.

####Contributor(s) sattarab ([email protected]) RenatoUtsch (https://github.com/RenatoUtsch)

####Issues If you find any issues please log it with a little description of how to re-produce it. I will try to resolve as soon as possible.

####Version 0.0.3 (Current latest stable version)

###License The MIT License

Copyright (c) sattarab email: [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.