-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,32 @@ | ||
# chartistcurvedlabels | ||
A chartistjs plugin that makes the curved labels on donut charts | ||
# Curved labels plugin for Chartist.js | ||
|
||
This is a chartist-js (https://gionkunz.github.io/chartist-js/index.html) javascript plugin that converts horizontal labels to curved labels on donut charts. | ||
|
||
Labels are placed horizontally by default. This plugin will orient the labels inside each donut "slice" and curve the labels, following the curve of the donut. | ||
|
||
To use, simply include this plugin in your list plugins in the option object you pass into the chartist chart you create. It looks for Pie charts with donut = true, so will only work with those types. | ||
|
||
```javascript | ||
var defaultOptions = { | ||
textAnchor: "middle", | ||
align: "center" | ||
} | ||
``` | ||
|
||
Example to create a chart with curved labels | ||
```javascript | ||
var curvedOptions = { | ||
donut: true, | ||
donutWidth: 45, | ||
donutSolid: true, | ||
startAngle: 0, | ||
showLabel: true, | ||
width: 400, | ||
height: 400, | ||
plugins: [ | ||
Chartist.plugins.curvedDonutLabels(), | ||
] | ||
}; | ||
|
||
new Chartist.Pie("#donutCurvedLabels", donutData, curvedOptions); | ||
``` |