PLT-3051 Fix broken site statistics (#3143)

Этот коммит содержится в:
enahum
2016-05-30 09:44:32 -03:00
коммит произвёл Christopher Speller
родитель f9aabcab5c
Коммит e4cb9141a4
4 изменённых файлов: 49 добавлений и 46 удалений

Просмотреть файл

@@ -42,7 +42,7 @@ export default class DoughnutChart extends React.Component {
} }
var el = ReactDOM.findDOMNode(this.refs.canvas); var el = ReactDOM.findDOMNode(this.refs.canvas);
var ctx = el.getContext('2d'); var ctx = el.getContext('2d');
this.chart = new Chart(ctx).Doughnut(this.props.data, this.props.options || {}); //eslint-disable-line new-cap this.chart = new Chart(ctx, {type: 'doughnut', data: this.props.data, options: this.props.options || {}}); //eslint-disable-line new-cap
} }
render() { render() {

Просмотреть файл

@@ -42,7 +42,7 @@ export default class LineChart extends React.Component {
} }
var el = ReactDOM.findDOMNode(this.refs.canvas); var el = ReactDOM.findDOMNode(this.refs.canvas);
var ctx = el.getContext('2d'); var ctx = el.getContext('2d');
this.chart = new Chart(ctx).Line(this.props.data, this.props.options || {}); //eslint-disable-line new-cap this.chart = new Chart(ctx, {type: 'line', data: this.props.data, options: this.props.options || {}}); //eslint-disable-line new-cap
} }
render() { render() {

Просмотреть файл

@@ -222,6 +222,11 @@ class SystemAnalytics extends React.Component {
/> />
} }
data={postCountsDay} data={postCountsDay}
options={{
legend: {
display: false
}
}}
width='740' width='740'
height='225' height='225'
/> />
@@ -235,6 +240,11 @@ class SystemAnalytics extends React.Component {
/> />
} }
data={userCountsWithPostsDay} data={userCountsWithPostsDay}
options={{
legend: {
display: false
}
}}
width='740' width='740'
height='225' height='225'
/> />
@@ -252,46 +262,28 @@ export default injectIntl(SystemAnalytics);
export function formatChannelDoughtnutData(totalPublic, totalPrivate, intl) { export function formatChannelDoughtnutData(totalPublic, totalPrivate, intl) {
const {formatMessage} = intl; const {formatMessage} = intl;
const channelTypeData = [ const channelTypeData = {
{ labels: [formatMessage(holders.analyticsPublicChannels), formatMessage(holders.analyticsPrivateGroups)],
value: totalPublic, datasets: [{
color: '#46BFBD', data: [totalPublic, totalPrivate],
highlight: '#5AD3D1', backgroundColor: ['#46BFBD', '#FDB45C'],
label: formatMessage(holders.analyticsPublicChannels) hoverBackgroundColor: ['#5AD3D1', '#FFC870']
}, }]
{ };
value: totalPrivate,
color: '#FDB45C',
highlight: '#FFC870',
label: formatMessage(holders.analyticsPrivateGroups)
}
];
return channelTypeData; return channelTypeData;
} }
export function formatPostDoughtnutData(filePosts, hashtagPosts, totalPosts, intl) { export function formatPostDoughtnutData(filePosts, hashtagPosts, totalPosts, intl) {
const {formatMessage} = intl; const {formatMessage} = intl;
const postTypeData = [ const postTypeData = {
{ labels: [formatMessage(holders.analyticsFilePosts), formatMessage(holders.analyticsHashtagPosts), formatMessage(holders.analyticsTextPosts)],
value: filePosts, datasets: [{
color: '#46BFBD', data: [filePosts, hashtagPosts, (totalPosts - filePosts - hashtagPosts)],
highlight: '#5AD3D1', backgroundColor: ['#46BFBD', '#F7464A', '#FDB45C'],
label: formatMessage(holders.analyticsFilePosts) hoverBackgroundColor: ['#5AD3D1', '#FF5A5E', '#FFC870']
}, }]
{ };
value: hashtagPosts,
color: '#F7464A',
highlight: '#FF5A5E',
label: formatMessage(holders.analyticsHashtagPosts)
},
{
value: totalPosts - filePosts - hashtagPosts,
color: '#FDB45C',
highlight: '#FFC870',
label: formatMessage(holders.analyticsTextPosts)
}
];
return postTypeData; return postTypeData;
} }
@@ -301,11 +293,11 @@ export function formatPostsPerDayData(data) {
labels: [], labels: [],
datasets: [{ datasets: [{
fillColor: 'rgba(151,187,205,0.2)', fillColor: 'rgba(151,187,205,0.2)',
strokeColor: 'rgba(151,187,205,1)', borderColor: 'rgba(151,187,205,1)',
pointColor: 'rgba(151,187,205,1)', pointBackgroundColor: 'rgba(151,187,205,1)',
pointStrokeColor: '#fff', pointBorderColor: '#fff',
pointHighlightFill: '#fff', pointHoverBackgroundColor: '#fff',
pointHighlightStroke: 'rgba(151,187,205,1)', pointHoverBorderColor: 'rgba(151,187,205,1)',
data: [] data: []
}] }]
}; };
@@ -325,12 +317,13 @@ export function formatUsersWithPostsPerDayData(data) {
var chartData = { var chartData = {
labels: [], labels: [],
datasets: [{ datasets: [{
label: '',
fillColor: 'rgba(151,187,205,0.2)', fillColor: 'rgba(151,187,205,0.2)',
strokeColor: 'rgba(151,187,205,1)', borderColor: 'rgba(151,187,205,1)',
pointColor: 'rgba(151,187,205,1)', pointBackgroundColor: 'rgba(151,187,205,1)',
pointStrokeColor: '#fff', pointBorderColor: '#fff',
pointHighlightFill: '#fff', pointHoverBackgroundColor: '#fff',
pointHighlightStroke: 'rgba(151,187,205,1)', pointHoverBorderColor: 'rgba(151,187,205,1)',
data: [] data: []
}] }]
}; };

Просмотреть файл

@@ -160,6 +160,11 @@ export default class TeamAnalytics extends React.Component {
/> />
} }
data={postCountsDay} data={postCountsDay}
options={{
legend: {
display: false
}
}}
width='740' width='740'
height='225' height='225'
/> />
@@ -173,6 +178,11 @@ export default class TeamAnalytics extends React.Component {
/> />
} }
data={userCountsWithPostsDay} data={userCountsWithPostsDay}
options={{
legend: {
display: false
}
}}
width='740' width='740'
height='225' height='225'
/> />