Skip to content
Snippets Groups Projects
Commit f0c8eb37 authored by tlansey's avatar tlansey
Browse files

merged

parents e754858e 988cdcfa
No related branches found
No related tags found
No related merge requests found
Showing
with 36 additions and 1952 deletions
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="a3ef59f7-ccc9-4e4a-8c11-cfee428bf55b" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1kTsysG5fzgCOZ8nIVbDL9gEYut" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="a3ef59f7-ccc9-4e4a-8c11-cfee428bf55b" name="Default Changelist" comment="" />
<created>1605736172345</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1605736172345</updated>
</task>
<servers />
</component>
</project>
\ No newline at end of file
import styled from 'styled-components';
import { palette } from 'styled-theme';
import WithDirection from '@imd/lib/helpers/rtl';
const ChartWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: center;
.isoChartControl {
display: flex;
align-items: center;
margin-left: ${props => (props['data-rtl'] === 'rtl' ? 'inherit' : 'auto')};
margin-right: ${props =>
props['data-rtl'] === 'rtl' ? 'auto' : 'inherit'};
margin-bottom: 20px;
span {
font-size: 13px;
color: ${palette('text', 1)};
font-weight: 400;
margin-right: ${props =>
props['data-rtl'] === 'rtl' ? 'inherit' : '15px'};
margin-left: ${props =>
props['data-rtl'] === 'rtl' ? '15px' : 'inherit'};
}
button {
border: 1px solid ${palette('border', 0)};
padding: 0 10px;
border-radius: 0;
position: relative;
span {
margin: 0;
}
&:last-child {
margin-left: ${props =>
props['data-rtl'] === 'rtl' ? 'inherit' : '-1px'};
margin-right: ${props =>
props['data-rtl'] === 'rtl' ? '-1px' : 'inherit'};
}
&:hover {
color: ${palette('primary', 0)};
border-color: ${palette('primary', 0)};
z-index: 1;
span {
color: ${palette('primary', 0)};
}
}
}
}
`;
export default WithDirection(ChartWrapper);
import React, { Component } from 'react';
import { Row, Col } from 'antd';
import FrappeChart from 'frappe-charts/dist/frappe-charts.min.esm';
import PageHeader from '@imd/components/utility/pageHeader';
import Box from '@imd/components/utility/box';
import LayoutWrapper from '@imd/components/utility/layoutWrapper';
import ContentHolder from '@imd/components/utility/contentHolder';
import Button from '@imd/components/uielements/button';
import basicStyle from '@imd/assets/styles/constants';
import * as configs from './config';
import 'frappe-charts/dist/frappe-charts.min.css';
export default class extends Component {
state = {
currentIndex: 2,
};
componentDidMount() {
new FrappeChart(configs.barChart);
new FrappeChart(configs.lineChart);
new FrappeChart(configs.scatterChart);
new FrappeChart(configs.pieChart);
new FrappeChart(configs.percentageChart);
this.updatedChart = new FrappeChart(configs.updatedChart);
}
addData = () => {
let { currentIndex } = this.state;
currentIndex += 1;
const data = configs.basicData.datasets[currentIndex % 3];
this.updatedChart.add_data_point(data.values, data.title);
this.setState({ currentIndex });
};
removeData = () => {
const { currentIndex } = this.state;
if (currentIndex > 0) {
this.updatedChart.remove_data_point(currentIndex);
this.setState({ currentIndex: currentIndex - 1 });
}
};
render() {
const { rowStyle, colStyle, gutter } = basicStyle;
return (
<LayoutWrapper className="isoMapPage">
<PageHeader>Frappe Charts</PageHeader>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={24} xs={24} style={colStyle}>
<Box title={configs.updatedChart.header}>
<ContentHolder>
<div style={{ display: 'flex', justifyContent: 'flex-end' }}>
<Button
onClick={this.addData}
style={{ marginRight: '10px' }}
>
+ Add Value
</Button>
<Button onClick={this.removeData}>Remove Value</Button>
</div>
<div id={configs.updatedChart.parentId} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={24} xs={24} style={colStyle}>
<Box title={configs.barChart.header}>
<ContentHolder>
<div id={configs.barChart.parentId} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={24} xs={24} style={colStyle}>
<Box title={configs.lineChart.header}>
<ContentHolder>
<div id={configs.lineChart.parentId} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={24} xs={24} style={colStyle}>
<Box title={configs.scatterChart.header}>
<ContentHolder>
<div id={configs.scatterChart.parentId} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.pieChart.header}>
<ContentHolder>
<div id={configs.pieChart.parentId} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.percentageChart.header}>
<ContentHolder>
<div id={configs.percentageChart.parentId} />
</ContentHolder>
</Box>
</Col>
</Row>
</LayoutWrapper>
);
}
}
export { FrappeChart };
const basicData = {
labels: [
'12am-3am',
'3am-6am',
'6am-9am',
'9am-12pm',
'12pm-3pm',
'3pm-6pm',
'6pm-9pm',
'9pm-12am',
],
datasets: [
{
title: 'Some Data',
color: 'light-blue',
values: [25, 40, 30, 35, 8, 52, 17, -4],
},
{
title: 'Another Set',
color: 'violet',
values: [25, 50, -10, 15, 18, 32, 27, 14],
},
{
title: 'Yet Another',
color: 'blue',
values: [15, 20, -3, -15, 58, 12, -17, 37],
},
],
};
const heatMapData = {};
const currentDate = new Date();
const heatMapStart = new Date(new Date().setMonth(1, 1));
let timestamp = currentDate.getTime() / 1000;
timestamp = Math.floor(timestamp - (timestamp % 86400)).toFixed(1); // convert to midnight
for (let i = 0; i < 375; i++) {
heatMapData[timestamp] = Math.floor(Math.random() * 6) + 1;
timestamp = Math.floor(timestamp - 86400).toFixed(1);
}
const basicConfig = {
height: 250,
format_tooltip_x: d => (d + '').toUpperCase(),
format_tooltip_y: d => d + ' pts',
};
const barChart = {
header: 'Bar Chart',
title: '',
parent: '#frappeBarChart',
parentId: 'frappeBarChart',
type: 'bar',
data: basicData,
...basicConfig,
};
const lineChart = {
header: 'Line Chart',
title: '',
parent: '#frappeLineChart',
parentId: 'frappeLineChart',
type: 'line',
data: basicData,
show_dots: 0,
heatline: 1,
region_fill: 1,
...basicConfig,
};
const scatterChart = {
header: 'Scatter Chart',
title: '',
parent: '#frappeScatterChart',
parentId: 'frappeScatterChart',
type: 'scatter',
data: basicData,
...basicConfig,
};
const pieChart = {
header: 'Pie Chart',
title: '',
parent: '#frappePieChart',
parentId: 'frappePieChart',
type: 'pie',
data: basicData,
...basicConfig,
};
const percentageChart = {
header: 'Percentage Chart',
title: '',
parent: '#frappePercentageChart',
parentId: 'frappePercentageChart',
type: 'percentage',
data: basicData,
...basicConfig,
};
const heatMap = {
header: 'Heatmap Chart',
title: '',
parent: '#heatmap',
parentId: 'heatmap',
type: 'heatmap',
height: 115,
data: heatMapData, //heatMapData,
discrete_domains: 1, // default: 0
start: heatMapStart,
};
const heatMapHalloween = {
header: 'Heatmap Chart Halloween',
title: '',
parent: '#heatmapHalloween',
parentId: 'heatmapHalloween',
type: 'heatmap',
height: 115,
data: heatMapData, //heatMapData,
discrete_domains: 1, // default: 0
start: heatMapStart,
legend_colors: ['#ebedf0', '#fdf436', '#ffc700', '#ff9100', '#06001c'],
};
const updatedChart = {
header: 'Updateable Chart',
title: '',
parent: '#frappeupdatedChart',
parentId: 'frappeupdatedChart',
data: basicData,
type: 'line',
show_dots: 0,
heatline: 1,
};
export {
barChart,
lineChart,
scatterChart,
pieChart,
percentageChart,
heatMap,
heatMapHalloween,
updatedChart,
basicData,
};
import React, { Component } from 'react';
import { Row, Col } from 'antd';
import PageHeader from '@imd/components/utility/pageHeader';
import Box from '@imd/components/utility/box';
import LayoutWrapper from '@imd/components/utility/layoutWrapper';
import ContentHolder from '@imd/components/utility/contentHolder';
import basicStyle from '@imd/assets/styles/constants';
import * as configs from './config';
import GoogleChart from 'react-google-charts';
export default class ReCharts extends Component {
render() {
const chartEvents = [
{
eventName: 'select',
callback(Chart) {},
},
];
const { rowStyle, colStyle, gutter } = basicStyle;
return (
<LayoutWrapper className="isoMapPage">
<PageHeader>Google Charts</PageHeader>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.BarChart.title}>
<ContentHolder>
<GoogleChart {...configs.BarChart} chartEvents={chartEvents} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.lineChart.title}>
<ContentHolder>
<GoogleChart {...configs.lineChart} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.BubbleChart.title}>
<ContentHolder>
<GoogleChart {...configs.BubbleChart} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.Histogram.title}>
<ContentHolder>
<GoogleChart {...configs.Histogram} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.ScatterChart.title}>
<ContentHolder>
<GoogleChart {...configs.ScatterChart} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.AreaChart.title}>
<ContentHolder>
<GoogleChart {...configs.AreaChart} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.CandlestickChart.title}>
<ContentHolder>
<GoogleChart {...configs.CandlestickChart} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.ComboChart.title}>
<ContentHolder>
<GoogleChart {...configs.ComboChart} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.DonutChart.title}>
<ContentHolder>
<GoogleChart {...configs.DonutChart} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.SteppedAreaChart.title}>
<ContentHolder>
<GoogleChart {...configs.SteppedAreaChart} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.Timeline.title}>
<ContentHolder>
<GoogleChart {...configs.Timeline} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.TreeMap.title}>
<ContentHolder>
<GoogleChart {...configs.TreeMap} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.TrendLines.title}>
<ContentHolder>
<GoogleChart {...configs.TrendLines} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.Waterfall.title}>
<ContentHolder>
<GoogleChart {...configs.Waterfall} />
</ContentHolder>
</Box>
</Col>
</Row>
<Row style={rowStyle} gutter={gutter} justify="start">
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.Gantt.title}>
<ContentHolder>
<GoogleChart {...configs.Gantt} />
</ContentHolder>
</Box>
</Col>
<Col md={12} xs={24} style={colStyle}>
<Box title={configs.WordTree.title}>
<ContentHolder>
<GoogleChart {...configs.WordTree} />
</ContentHolder>
</Box>
</Col>
</Row>
</LayoutWrapper>
);
}
}
export { GoogleChart };
This diff is collapsed.
import React, { Component } from 'react';
import { Bar } from 'react-chartjs-2';
import { data, barSettings } from './BarConfig';
export default class extends Component {
render() {
return (
<div>
<Bar
data={data}
width={barSettings.width}
height={barSettings.height}
options={{ maintainAspectRatio: false }}
/>
</div>
);
}
}
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'My First dataset',
backgroundColor: 'rgba(255,99,132,0.2)',
borderColor: 'rgba(255,99,132,1)',
borderWidth: 1,
hoverBackgroundColor: 'rgba(255,99,132,0.4)',
hoverBorderColor: 'rgba(255,99,132,1)',
data: [65, 59, 80, 81, 56, 55, 40],
},
],
};
const barSettings = {
height: 350,
};
export { data, barSettings };
import React, { Component } from 'react';
import { Bubble } from 'react-chartjs-2';
import { data } from './BubbleConfig';
export default class extends Component {
render() {
return <Bubble data={data} />;
}
}
const data = {
labels: ['January'],
datasets: [
{
label: 'My First dataset',
fill: false,
lineTension: 0.1,
backgroundColor: 'rgba(72,166,242,0.2)',
borderColor: 'rgba(72,166,242,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(72,166,242,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(72,166,242,1)',
pointHoverBorderColor: 'rgba(220,220,220,1)',
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [{ x: 10, y: 20, r: 5 }],
},
],
};
export { data };
import React, { Component } from 'react';
import { Doughnut } from 'react-chartjs-2';
import { data } from './DoughnutConfig';
export default class extends Component {
render() {
return <Doughnut data={data} />;
}
}
const data = {
labels: ['Red', 'Blue', 'Yellow'],
datasets: [
{
data: [300, 50, 100],
backgroundColor: ['#ff6384', '#48A6F2', '#ffbf00'],
hoverBackgroundColor: ['#FF6384', '#48A6F2', '#ffbf00'],
},
],
};
export { data };
import React, { Component } from 'react';
import { Doughnut } from 'react-chartjs-2';
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const getState = () => ({
labels: ['Red', 'Blue', 'Yellow'],
datasets: [
{
data: [
getRandomInt(50, 200),
getRandomInt(100, 150),
getRandomInt(150, 250),
],
backgroundColor: ['#ff6384', '#48A6F2', '#ffbf00'],
hoverBackgroundColor: ['#FF6384', '#48A6F2', '#ffbf00'],
},
],
});
export default class DynamicDoughnutChart extends Component {
constructor(props) {
super(props);
this.state = getState();
}
componentWillMount() {
setInterval(() => {
this.setState(getState());
}, 5000);
}
render() {
return <Doughnut data={this.state} />;
}
}
import React, { Component } from 'react';
import { HorizontalBar } from 'react-chartjs-2';
import { data } from './HorizontalConfig';
export default class HorizontalChart extends Component {
render() {
return <HorizontalBar data={data} />;
}
}
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'My First dataset',
backgroundColor: 'rgba(255,99,132,0.2)',
borderColor: 'rgba(255,99,132,1)',
borderWidth: 1,
hoverBackgroundColor: 'rgba(255,99,132,0.4)',
hoverBorderColor: 'rgba(255,99,132,1)',
data: [65, 59, 80, 81, 56, 55, 40],
},
],
options: {
defaultFontColor: '#788195',
},
};
export { data };
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'My First dataset',
fill: false,
lineTension: 0.1,
backgroundColor: 'rgba(72,166,242,0.6)',
borderColor: 'rgba(72,166,242,1)',
borderCapStyle: 'butt',
borderDash: [],
borderDashOffset: 0.0,
borderJoinStyle: 'miter',
pointBorderColor: 'rgba(72,166,242,1)',
pointBackgroundColor: '#fff',
pointBorderWidth: 1,
pointHoverRadius: 5,
pointHoverBackgroundColor: 'rgba(72,166,242,1)',
pointHoverBorderColor: 'rgba(72,166,242,1)',
pointHoverBorderWidth: 2,
pointRadius: 1,
pointHitRadius: 10,
data: [65, 59, 80, 81, 56, 55, 40],
},
],
};
export { data };
import React from 'react';
import { Bar } from 'react-chartjs-2';
import * as config from './MixConfig';
export default () => <Bar {...config} />;
const data = {
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
datasets: [
{
label: 'Sales',
type: 'line',
data: [51, 65, 40, 49, 60, 37, 40],
fill: false,
borderColor: '#EC932F',
backgroundColor: '#EC932F',
pointBorderColor: '#EC932F',
pointBackgroundColor: '#EC932F',
pointHoverBackgroundColor: '#EC932F',
pointHoverBorderColor: '#EC932F',
yAxisID: 'y-axis-2',
},
{
type: 'bar',
label: 'Visitor',
data: [200, 185, 590, 621, 250, 400, 95],
fill: false,
backgroundColor: '#71B37C',
borderColor: '#71B37C',
hoverBackgroundColor: '#71B37C',
hoverBorderColor: '#71B37C',
yAxisID: 'y-axis-1',
},
],
};
const options = {
responsive: true,
tooltips: {
mode: 'label',
},
elements: {
line: {
fill: false,
},
},
scales: {
xAxes: [
{
display: true,
gridLines: {
display: false,
},
},
],
yAxes: [
{
type: 'linear',
display: true,
position: 'left',
id: 'y-axis-1',
gridLines: {
display: false,
},
},
{
type: 'linear',
display: true,
position: 'right',
id: 'y-axis-2',
gridLines: {
display: false,
},
},
],
},
};
const plugins = [
{
afterDraw: (chartInstance, easing) => {
const ctx = chartInstance.chart.ctx;
ctx.fillText('This text drawn by a plugin', 100, 100);
},
},
];
export { data, options, plugins };
const data = {
labels: ['Red', 'Green', 'Yellow'],
datasets: [
{
data: [300, 50, 100],
backgroundColor: ['#FF6384', '#48A6F2', '#ffbf00'],
hoverBackgroundColor: ['#FF6384', '#48A6F2', '#ffbf00'],
},
],
};
export { data };
import React, { Component } from 'react';
import { Polar } from 'react-chartjs-2';
import { data } from './PolarConfig';
export default class extends Component {
render() {
return <Polar data={data} height={230} />;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment