-
Notifications
You must be signed in to change notification settings - Fork 16
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
1 parent
12f1d15
commit e9d0bd9
Showing
4 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
playbook/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_dog.jsx
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,72 @@ | ||
import React from 'react' | ||
import ReactDOMServer from 'react-dom/server' | ||
import BarGraph from '../_bar_graph' | ||
import Icon from '../../pb_icon/_icon' | ||
|
||
const chartData = [ | ||
{ | ||
name: 'Role', | ||
data: [0, 200, 300, 654, 656], | ||
}, | ||
{ | ||
name: 'Company', | ||
data: [150, 524, 320, 440, 500], | ||
}, | ||
] | ||
|
||
const renderIcon = (iconName, color) => { | ||
return ReactDOMServer.renderToStaticMarkup( | ||
<Icon | ||
color={color} | ||
icon={iconName} | ||
/>) | ||
}; | ||
|
||
const barGraphOptions = { | ||
yAxis: { | ||
tickInterval: 5, | ||
}, | ||
xAxis: { | ||
categories: ['1', '2', '3', '4', '5'], | ||
labels: { | ||
useHTML: true, | ||
formatter: function () { | ||
switch (this.value) { | ||
case '1': | ||
return `${renderIcon('frown', 'error')}`; | ||
case '2': | ||
return `${renderIcon('frown', 'warning')}`; | ||
case '3': | ||
return `${renderIcon('frown-open', 'neutral')}`; | ||
case '4': | ||
return `${renderIcon('smile', 'category_7')}`; | ||
case '5': | ||
return `${renderIcon('smile-beam', 'success')}`; | ||
default: | ||
return '' | ||
} | ||
}, | ||
style: { | ||
fontSize: '1.4em', | ||
}, | ||
y: 42, | ||
}, | ||
}, | ||
legend: { | ||
itemMarginTop: 62, | ||
}, | ||
} | ||
|
||
const BarGraphDog = () => ( | ||
<div> | ||
<BarGraph | ||
chartData={chartData} | ||
customOptions={barGraphOptions} | ||
id="happiness-dashboard" | ||
legend | ||
title="Bar Graph with Custom Overrides" | ||
/> | ||
</div> | ||
) | ||
|
||
export default BarGraphDog |
1 change: 1 addition & 0 deletions
1
playbook/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_dog.md
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 @@ | ||
you can use highcharts and pass plabyook styles to it |
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