Skip to content

Commit 5c4947b

Browse files
authored
Added syntax highlighting to readme example
1 parent 90db76a commit 5c4947b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Live demo: [gor181.github.io/react-chartjs-2](http://gor181.github.io/react-char
1212

1313
To build the examples locally, run:
1414

15-
```
15+
```bash
1616
npm install
1717
npm start
1818
```
@@ -22,7 +22,7 @@ Then open [`localhost:8000`](http://localhost:8000) in a browser.
2222

2323
## Installation via NPM
2424

25-
```
25+
```bash
2626
npm install react-chartjs-2 chart.js --save
2727
```
2828

@@ -31,7 +31,7 @@ npm install react-chartjs-2 chart.js --save
3131

3232
Check example/src/components/* for usage.
3333

34-
```
34+
```js
3535
import {Doughnut} from 'react-chartjs-2';
3636

3737
<Doughnut data={...} />
@@ -50,7 +50,7 @@ import {Doughnut} from 'react-chartjs-2';
5050
### Custom size
5151
In order for Chart.js to obey the custom size you need to set `maintainAspectRatio` to false, example:
5252

53-
```
53+
```js
5454
<Bar
5555
data={data}
5656
width={100}
@@ -64,7 +64,7 @@ In order for Chart.js to obey the custom size you need to set `maintainAspectRat
6464
### Chart.js instance
6565
Chart.js instance can be accessed by placing a ref to the element as:
6666

67-
```
67+
```js
6868
render() {
6969
componentDidMount() {
7070
console.log(this.refs.chart.chart_instance); // returns a Chart.js instance reference
@@ -87,7 +87,7 @@ defaults.global.animation = false;
8787

8888
If you want to bulk set properties, try using the [lodash.merge](https://lodash.com/docs/#merge) function. This function will do a deep recursive merge preserving previously set values that you don't want to update.
8989

90-
```javascript
90+
```js
9191
import { defaults } from 'react-chartjs-2';
9292
import merge from 'lodash.merge';
9393
// or
@@ -109,7 +109,7 @@ merge(defaults, {
109109

110110
A function to be called when mouse clicked on chart elememts, will return all element at that point as an array. [Check](https://github.com/chartjs/Chart.js/blob/master/docs/09-Advanced.md#getelementsatevente)
111111

112-
```
112+
```js
113113
{
114114
onElementsClick: (elems) => {}
115115
// `elems` is an array of chartElements

0 commit comments

Comments
 (0)