Skip to content

Commit 7cfc476

Browse files
committed
+README, +LICENSE, more attributes
1 parent a581600 commit 7cfc476

File tree

4 files changed

+58
-2
lines changed

4 files changed

+58
-2
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# AngularChart
2+
3+
AngularChart is an angularjs directive that wants to simplify the creation of a chart.
4+
It lets you to create a chart in a declarative way with the minimum effort using specific html tags.
5+
6+
## Usage
7+
8+
### Example
9+
For a line chart, put in your html file:
10+
11+
`
12+
<chart title="Line chart example" xData="lineChartXData" yData="lineChartYData" xName="Month" yName="Hit" ></chart>
13+
`
14+
15+
where xData and yData attributes specify the name of the variables that point to the chart data, and that must be created in corresponding angularjs scope.
16+
17+
### Format of chart data
18+
19+
It depends on type of the chart.
20+
If the chart is a line chart, the data is an object with 2 properties:
21+
* xData: data of x axis, it is an array of values
22+
* yData: data of y axis, it is an array of objects, where every has 2 parameters
23+
** name: specify the name of the line
24+
** data: an array of values. The lenght of the array is the same length of xData, and the value in each position of the array coresponds to the x value at same position in the xData array
25+
26+
See the example, and `examples/data/line-.chart.json` file to see the format of data of a line chart.
27+
28+
### Type of charts
29+
30+
Now it supports only a line chart, and it uses HighCharts library to build the charts. More types and more libraries will be supported in the next future.
31+
32+
## TODO
33+
34+
* support for more library to build the charts
35+
* support for more types of charts
36+
37+

angular-chart.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ angular.module('AngularChart', []).directive('chart', function () {
1919
x:-20 //center
2020
},
2121
subtitle:{
22-
text:'by top K pattern',
22+
text:attrs.subtitle,
2323
x:-20
2424
},
2525
xAxis:{

examples/LICENSE

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2011, Giovanni Gaglione (//github.com/bitliner)
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

examples/views/charts.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<h1>Line chart</h1>
2-
<chart title="Line chart example" xData="lineChartXData" yData="lineChartYData" xName="Month" yName="Hit"></chart>
2+
<chart title="Line chart example" xData="lineChartXData" yData="lineChartYData" xName="Month" yName="Hit" subtitle="This is an example"></chart>
33
<!-- yInterval, yMin, yMax, subtitle -->

0 commit comments

Comments
 (0)