import React from 'react';
import { View } from 'react-native';
import {
RkComponent,
RkText,
RkTheme,
RkStyleSheet,
} from 'react-native-ui-kitten';
import { VictoryPie } from 'victory-native';
import { Svg, Text as SvgText } from 'react-native-svg';
import { scale } from '../../utils/scale';
export class DoughnutChart extends RkComponent {
state = {
selected: 0,
data: [
{
x: 1,
y: 240,
title: '24%',
name: 'Likes',
color: RkTheme.current.colors.charts.doughnut[0],
},
{
x: 2,
y: 270,
title: '27%',
name: 'Comments',
color: RkTheme.current.colors.charts.doughnut[1],
},
{
x: 3,
y: 170,
title: '17%',
name: 'Shares',
color: RkTheme.current.colors.charts.doughnut[2],
},
{
x: 4,
y: 320,
title: '32%',
name: 'People',
color: RkTheme.current.colors.charts.doughnut[3],
},
],
};
size = 300;
fontSize = 40;
computeColors = () => this.state.data.map(i => i.color);
onPeopleChartPressed = (event, props) => {
this.setState({
selected: props.index,
});
};
renderMarkdown = () => this.state.data.map(this.renderMarkdownItem);
renderMarkdownItem = (item) => (
{item.name}
);
render = () => (
AUDIENCE OVERVIEW
{this.renderMarkdown()}
);
}
const styles = RkStyleSheet.create(() => ({
legendContainer: {
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-around',
},
legendItem: {
flexDirection: 'row',
alignItems: 'center',
},
itemBadge: {
width: 10,
height: 10,
borderRadius: 5,
marginRight: 5,
},
}));