Skip to content

Commit 373f0a7

Browse files
committed
Merge pull request #32 from dominicrico/master
Additional options for tooltips
2 parents 2c7131c + 6fc9cc2 commit 373f0a7

16 files changed

+381
-166
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ node_modules
2828
.lock-wscript
2929

3030
bower_components
31+
32+
#Sass Cache
33+
.sass-cache

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ Please visit http://gionkunz.github.io/chartist-js/plugins.html for more informa
88

99
```javascript
1010
var defaultOptions = {
11-
currency: null //accepts '£', '$', '€', etc.
11+
currency: undefined, //accepts '£', '$', '€', etc.
1212
//e.g. 4000 => €4,000
13+
tooltipFnc: undefined, //accepts function
14+
//build custom tooltip
15+
class: undefined, // accecpts 'class1', 'class1 class2', etc.
16+
//adds class(es) to tooltip wrapper
17+
appendToBody: false //accepts true or false
18+
//appends tooltips to body instead of chart container
1319
};
1420
```
1521

@@ -23,13 +29,13 @@ var chart = new Chartist.Line('.ct-chart', {
2329
labels: [1, 2, 3],
2430
series: [
2531
[
26-
{meta: 'description', value: 1 },
27-
{meta: 'description', value: 5},
32+
{meta: 'description', value: 1},
33+
{meta: 'description', value: 5},
2834
{meta: 'description', value: 3}
2935
],
3036
[
31-
{meta: 'other description', value: 2},
32-
{meta: 'other description', value: 4},
37+
{meta: 'other description', value: 2},
38+
{meta: 'other description', value: 4},
3339
{meta: 'other description', value: 2}
3440
]
3541
]
@@ -40,7 +46,7 @@ var chart = new Chartist.Line('.ct-chart', {
4046
});
4147
```
4248

43-
without:
49+
without descriptive text:
4450
```js
4551
var chart = new Chartist.Line('.ct-chart', {
4652
labels: [1, 2, 3, 4, 5, 6, 7],
@@ -54,3 +60,29 @@ var chart = new Chartist.Line('.ct-chart', {
5460
]
5561
});
5662
```
63+
64+
With options text:
65+
```js
66+
var chart = new Chartist.Line('.ct-chart', {
67+
labels: [1, 2, 3],
68+
series: [
69+
[
70+
{meta: 'description', value: 1},
71+
{meta: 'description', value: 5},
72+
{meta: 'description', value: 3}
73+
],
74+
[
75+
{meta: 'other description', value: 2},
76+
{meta: 'other description', value: 4},
77+
{meta: 'other description', value: 2}
78+
]
79+
]
80+
}, {
81+
plugins: [
82+
Chartist.plugins.tooltip({
83+
currency: '$',
84+
class: 'class1 class2',
85+
appendToBody: true
86+
})
87+
]
88+
});

dist/chartist-plugin-tooltip.css

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/chartist-plugin-tooltip.css.map

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)