diff --git a/App.js b/App.js index 9b2542e7..73310197 100644 --- a/App.js +++ b/App.js @@ -142,6 +142,8 @@ export default class App extends React.Component { chartConfig={chartConfig} accessor="population" style={graphStyle} + bgColor="transparent" + paddingLeft="15" /> Line Chart ``` @@ -214,6 +219,8 @@ const data = [ | height | Number | Height of the chart | | chartConfig | Object | Configuration object for the chart, see example config in the beginning of this file | | accessor | string | Property in the `data` object from which the number values are taken | +| bgColor | string | background color - if you want to set transparent, input `transparent` or `none`. | +| paddingLeft | string | left padding of the pie chart | ## Contribution graph (heatmap) diff --git a/data.js b/data.js index 52f92363..96b12f5f 100644 --- a/data.js +++ b/data.js @@ -51,11 +51,11 @@ const contributionData = [ // Mock data object for Pie Chart const pieChartData = [ - { name: 'Italy', population: Math.random() * 10000 }, - { name: 'Mexico', population: Math.random() * 10000 }, - { name: 'France', population: Math.random() * 10000 }, - { name: 'Argentina', population: Math.random() * 10000 }, - { name: 'Japan', population: Math.random() * 10000 } + { name: 'Seoul', population: 21500000, color: 'rgba(131, 167, 234, 1)', legendFontColor: '#7F7F7F', legendFontSize: 15 }, + { name: 'Toronto', population: 2800000, color: '#F00', legendFontColor: '#7F7F7F', legendFontSize: 15 }, + { name: 'Beijing', population: 527612, color: 'red', legendFontColor: '#7F7F7F', legendFontSize: 15 }, + { name: 'New York', population: 8538000, color: '#ffffff', legendFontColor: '#7F7F7F', legendFontSize: 15 }, + { name: 'Moscow', population: 11920000, color: 'rgb(0, 0, 255)', legendFontColor: '#7F7F7F', legendFontSize: 15 } ] // Mock data object for Progress diff --git a/src/pie-chart.js b/src/pie-chart.js index a3f05e76..c0727a7d 100644 --- a/src/pie-chart.js +++ b/src/pie-chart.js @@ -13,7 +13,7 @@ const Pie = require('paths-js/pie') class PieChart extends AbstractChart { render() { - const { style = {} } = this.props + const { style = {}, backgroundColor } = this.props const { borderRadius = 0 } = style const chart = Pie({ center: this.props.center || [0, 0], @@ -32,20 +32,20 @@ class PieChart extends AbstractChart { {Math.round(100 / total * c.item[this.props.accessor])}% { c.item.name } @@ -71,9 +71,9 @@ class PieChart extends AbstractChart { height: this.props.height, ...this.props.chartConfig })} - + {slices} diff --git a/src/piechart_modified.png b/src/piechart_modified.png new file mode 100644 index 00000000..e398c16b Binary files /dev/null and b/src/piechart_modified.png differ