Skip to content

Commit dc10a2c

Browse files
committed
FAQ in the README
1 parent c8664af commit dc10a2c

1 file changed

Lines changed: 45 additions & 11 deletions

File tree

README.md

Lines changed: 45 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,72 @@ An AngularJS directive for ZingChart to make your charts work dynamically with y
66
#### Try out our demo! http://zingchart.github.io/ZingChart-AngularJS
77
#### Full blog post @ http://www.zingchart.com/blog/2015/03/05/zingchart-angularjs/
88

9-
---
10-
11-
Note: As of v1.0.1, the attribute is now exposed to the directive allowing you to bind the zingchart directive to an actual DOM element along with the `<zingchart>` element. This will allow you to utilize percentage values in the height/width render options while maintaining a DIV's inherit properties. The following are equivalent :
9+
* [Install](#install)
10+
* [Usage](#usage)
11+
* [FAQ](#faq)
12+
* [Options](#options)
1213

13-
`<div zingchart zc-values="myValues"></div>`
14-
15-
`<zingchart zc-values="myValues"></zingchart>`
1614

15+
<a id="install"></a>
1716
## Install
18-
19-
2017
```
2118
bower install zingchart-angularjs
2219
```
2320

2421
Inject into your app...
22+
2523
```js
2624
var app = angular.module('myApp', ['zingchart-angularjs']);
2725
```
2826

27+
<a id="usage"></a>
2928
## Usage
30-
_javascript_
29+
**_javascript_**
30+
3131
```js
3232
//In an Angular Controller
3333
$scope.myValues = [5,6,3,2,3];
3434
```
3535

36-
_markup_
36+
**_markup_**
37+
3738
```html
3839
<zingchart id="chart-1" zc-values="myValues"></zingchart>
3940
```
4041

42+
or
43+
44+
```html
45+
<div zingchart id="chart-1" zc-values="myValues"></dib>
46+
```
47+
48+
49+
<a id="faq"></a>
50+
##FAQ
51+
52+
> How do I make my charts responsive?
53+
54+
**Background**
55+
56+
ZingChart internally attaches itself to the element that is specified in the render function, and continues to build children elements inside. In this Angular directives case, it will attach itself to either :
57+
58+
* The `<zingchart>` if the element binding syntax is used
59+
* The `<div>` if the `zingchart` attribute binding syntax is used.
60+
61+
Since the element `zingchart` is not a valid HTML element, the browser will not assign css attributes to the element where as a div has inherit properties such as `display:block`.
62+
63+
**How to**
64+
65+
We reccomended using the attribute binding syntax on a div to automatically inherit the `display:block` CSS attribute. You will also need to apply a value of `100%` to the zc-height and zc-width attributes.
66+
67+
Example :
68+
69+
```
70+
<div zingchart id="chart-1" zc-width="100%" zc-height="100%"></div>
71+
```
72+
73+
74+
<a id="options"></a>
4175
## Options
4276
The ZingChart Component takes the following attributes:
4377

@@ -185,4 +219,4 @@ Will override the render type inside of a zc-render and zc-data object if define
185219
<zingchart id="chart-1" zc-type="bar"/zingchart>
186220
```
187221

188-
---
222+

0 commit comments

Comments
 (0)