forked from reactchartjs/react-chartjs-2
-
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.
feat: support 'scatter' charts out-of-the-box
Chartjs has default config for scatter charts which are different than line charts in four key areas: * x and y axis are both `linear`. * hover mode is `single`. * showLines is `false`. * tooltip title doesn't make sense, as both x and y are both values. Keeping in mind that this default config is already present within the base chartjs library, a different 'Scatter' chart should be exposed by this library - to avoid redundant configs to be written by each developer.
- Loading branch information
Kumar Harsh
committed
Jul 3, 2017
1 parent
15f1448
commit a711447
Showing
4 changed files
with
65 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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import {Scatter} from 'react-chartjs-2'; | ||
|
||
const data = { | ||
labels: ['Scatter'], | ||
datasets: [ | ||
{ | ||
label: 'My First dataset', | ||
fill: false, | ||
backgroundColor: 'rgba(75,192,192,0.4)', | ||
pointBorderColor: 'rgba(75,192,192,1)', | ||
pointBackgroundColor: '#fff', | ||
pointBorderWidth: 1, | ||
pointHoverRadius: 5, | ||
pointHoverBackgroundColor: 'rgba(75,192,192,1)', | ||
pointHoverBorderColor: 'rgba(220,220,220,1)', | ||
pointHoverBorderWidth: 2, | ||
pointRadius: 1, | ||
pointHitRadius: 10, | ||
data: [ | ||
{ x: 65, y: 75 }, | ||
{ x: 59, y: 49 }, | ||
{ x: 80, y: 90 }, | ||
{ x: 81, y: 29 }, | ||
{ x: 56, y: 36 }, | ||
{ x: 55, y: 25 }, | ||
{ x: 40, y: 18 }, | ||
] | ||
} | ||
] | ||
}; | ||
|
||
export default React.createClass({ | ||
displayName: 'ScatterExample', | ||
|
||
render() { | ||
return ( | ||
<div> | ||
<h2>Scatter Example</h2> | ||
<Scatter data={data} /> | ||
</div> | ||
); | ||
} | ||
}); |
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
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