Max Red - Finished StatsChart component, started full component [skip ci]

This commit is contained in:
ivan 2017-01-14 14:17:35 -03:00
parent d12194cd34
commit 1e69e6f4f8
2 changed files with 63 additions and 55 deletions

View File

@ -25,14 +25,6 @@ class StatsChart extends React.Component {
); );
} }
shouldBeDeleted(min, max, num, type) {
var rtn = [];
while (rtn.length < num) {
rtn.push(Math.floor((Math.random() * (max - min)) + min + ((Math.random() > 0.1) ? type * 3 : 0)));
}
return rtn;
}
getChartData() { getChartData() {
let labels = this.getLabels(); let labels = this.getLabels();
@ -47,7 +39,6 @@ class StatsChart extends React.Component {
for (let i = 0; i < this.props.strokes.length; i++) { for (let i = 0; i < this.props.strokes.length; i++) {
let stroke = this.props.strokes[i]; let stroke = this.props.strokes[i];
console.log(color[stroke.name]);
let dataset = { let dataset = {
label: i18n('CHART_' + stroke.name), label: i18n('CHART_' + stroke.name),
@ -77,10 +68,6 @@ class StatsChart extends React.Component {
let labels = []; let labels = [];
for (let i = 0; i < this.props.display; i++) { for (let i = 0; i < this.props.display; i++) {
if(i % 2 == 0 && this.props.display > 20){
labels.push('');
continue;
}
let firstList = this.props.strokes[0]; let firstList = this.props.strokes[0];
let idx = firstList.values[i].date.slice(4, 6) - 1; let idx = firstList.values[i].date.slice(4, 6) - 1;
labels.push( firstList.values[i].date.slice(6, 8) + ' ' + months[idx]); labels.push( firstList.values[i].date.slice(6, 8) + ' ' + months[idx]);
@ -89,8 +76,7 @@ class StatsChart extends React.Component {
return labels; return labels;
} }
hitRadius(name) { hitRadius() {
/// SHOULD AJUSTAR THIS VALUES
if (this.props.display === 7) return 20; if (this.props.display === 7) return 20;
if (this.props.display === 30) return 15; if (this.props.display === 30) return 15;
if (this.props.display === 90) return 10; if (this.props.display === 90) return 10;

View File

@ -4,6 +4,8 @@ import i18n from 'lib-app/i18n';
import Header from 'core-components/header'; import Header from 'core-components/header';
import DropDown from 'core-components/drop-down'; import DropDown from 'core-components/drop-down';
import ToggleList from 'core-components/toggle-list';
import StatsChart from 'app/admin/panel/dashboard/admin-panel-stats-chart'; import StatsChart from 'app/admin/panel/dashboard/admin-panel-stats-chart';
class AdminPanelStats extends React.Component { class AdminPanelStats extends React.Component {
@ -13,11 +15,31 @@ class AdminPanelStats extends React.Component {
<div> <div>
<Header title={i18n('TICKET_ACTIVITY')}/> <Header title={i18n('TICKET_ACTIVITY')}/>
<DropDown {...this.getDropDownProps()}/> <DropDown {...this.getDropDownProps()}/>
<ToggleList {...this.getToggleListProps()} />
<StatsChart {...this.getStatsChartProps()} /> <StatsChart {...this.getStatsChartProps()} />
</div> </div>
); );
} }
getToggleListProps() {
return {
items: [
{
content: <div></div>
},
{
content: <div></div>
},
{
content: <div></div>
},
{
content: <div></div>
}
]
};
}
getDropDownProps() { getDropDownProps() {
return { return {
items: [ items: [
@ -51,15 +73,15 @@ class AdminPanelStats extends React.Component {
values: [ values: [
{ {
date: "20160420", date: "20160420",
value: 71 value: 17
}, },
{ {
date: "20160421", date: "20160421",
value: 21 value: 15
}, },
{ {
date: "20160422", date: "20160422",
value: 4 value: 12
}, },
{ {
date: "20160423", date: "20160423",
@ -67,49 +89,15 @@ class AdminPanelStats extends React.Component {
}, },
{ {
date: "20160424", date: "20160424",
value: 12 value: 10
}, },
{ {
date: "20160425", date: "20160425",
value: 14 value: 7
}, },
{ {
date: "20160426", date: "20160426",
value: 22 value: 5
}
]
},
{
name: 'CLOSE',
show: true,
values: [
{
date: "20160420",
value: 20
},
{
date: "20160421",
value: 15
},
{
date: "20160422",
value: 13
},
{
date: "20160423",
value: 15
},
{
date: "20160424",
value: 12
},
{
date: "20160425",
value: 19
},
{
date: "20160426",
value: 23
} }
] ]
}, },
@ -146,6 +134,40 @@ class AdminPanelStats extends React.Component {
value: 6 value: 6
} }
] ]
},
{
name: 'CLOSE',
show: true,
values: [
{
date: "20160420",
value: 4
},
{
date: "20160421",
value: 7
},
{
date: "20160422",
value: 4
},
{
date: "20160423",
value: 7
},
{
date: "20160424",
value: 9
},
{
date: "20160425",
value: 11
},
{
date: "20160426",
value: 13
}
]
} }
] ]
} }