-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
168 additions
and
165 deletions.
There are no files selected for viewing
148 changes: 74 additions & 74 deletions
148
client/src/pages/admin/stats/conversation-stats-commenters-voters.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,78 @@ | ||
import React from "react" | ||
import PropTypes from "prop-types" | ||
import { VictoryChart } from "victory-chart" | ||
import { VictoryLine } from "victory-line" | ||
import { VictoryAxis } from "victory-axis" | ||
import { scaleLinear, scaleTime } from "d3-scale" | ||
// import React from "react" | ||
// import PropTypes from "prop-types" | ||
// import { VictoryChart } from "victory-chart" | ||
// import { VictoryLine } from "victory-line" | ||
// import { VictoryAxis } from "victory-axis" | ||
// import { scaleLinear, scaleTime } from "d3-scale" | ||
|
||
class CommentersVoters extends React.Component< | ||
{ | ||
chartWidth: number | ||
chartHeight: number | ||
data: { | ||
firstVoteTimes: number[] | ||
firstCommentTimes: number[] | ||
} | ||
}, | ||
{} | ||
> { | ||
static propTypes: {} | ||
// class CommentersVoters extends React.Component< | ||
// { | ||
// chartWidth: number | ||
// chartHeight: number | ||
// data: { | ||
// firstVoteTimes: number[] | ||
// firstCommentTimes: number[] | ||
// } | ||
// }, | ||
// {} | ||
// > { | ||
// static propTypes: {} | ||
|
||
render() { | ||
return ( | ||
<VictoryChart | ||
width={this.props.chartWidth} | ||
height={this.props.chartHeight} | ||
scale={{ | ||
x: scaleTime(this.props.data.firstVoteTimes), | ||
y: scaleLinear(), | ||
}} | ||
> | ||
<VictoryLine | ||
style={{ | ||
data: { | ||
strokeWidth: 2, | ||
stroke: "tomato", | ||
}, | ||
}} | ||
data={this.props.data.firstCommentTimes.map((timestamp, i) => { | ||
return { x: timestamp, y: i } | ||
})} | ||
/> | ||
<VictoryLine | ||
style={{ | ||
data: { | ||
strokeWidth: 2, | ||
stroke: "gold", | ||
}, | ||
}} | ||
data={this.props.data.firstVoteTimes.map((timestamp, i) => { | ||
return { x: timestamp, y: i } | ||
})} | ||
/> | ||
<VictoryAxis orientation="bottom" /> | ||
<VictoryAxis | ||
dependentAxis | ||
label={"Participants"} | ||
style={{ | ||
label: { | ||
fontSize: "8px", | ||
}, | ||
}} | ||
orientation={"left"} | ||
/> | ||
</VictoryChart> | ||
) | ||
} | ||
} | ||
// render() { | ||
// return ( | ||
// <VictoryChart | ||
// width={this.props.chartWidth} | ||
// height={this.props.chartHeight} | ||
// scale={{ | ||
// x: scaleTime(this.props.data.firstVoteTimes), | ||
// y: scaleLinear(), | ||
// }} | ||
// > | ||
// <VictoryLine | ||
// style={{ | ||
// data: { | ||
// strokeWidth: 2, | ||
// stroke: "tomato", | ||
// }, | ||
// }} | ||
// data={this.props.data.firstCommentTimes.map((timestamp, i) => { | ||
// return { x: timestamp, y: i } | ||
// })} | ||
// /> | ||
// <VictoryLine | ||
// style={{ | ||
// data: { | ||
// strokeWidth: 2, | ||
// stroke: "gold", | ||
// }, | ||
// }} | ||
// data={this.props.data.firstVoteTimes.map((timestamp, i) => { | ||
// return { x: timestamp, y: i } | ||
// })} | ||
// /> | ||
// <VictoryAxis orientation="bottom" /> | ||
// <VictoryAxis | ||
// dependentAxis | ||
// label={"Participants"} | ||
// style={{ | ||
// label: { | ||
// fontSize: "8px", | ||
// }, | ||
// }} | ||
// orientation={"left"} | ||
// /> | ||
// </VictoryChart> | ||
// ) | ||
// } | ||
// } | ||
|
||
CommentersVoters.propTypes = { | ||
chartWidth: PropTypes.number, | ||
chartHeight: PropTypes.number, | ||
data: PropTypes.shape({ | ||
firstVoteTimes: PropTypes.arrayOf(PropTypes.number), | ||
firstCommentTimes: PropTypes.arrayOf(PropTypes.number), | ||
}), | ||
} | ||
// CommentersVoters.propTypes = { | ||
// chartWidth: PropTypes.number, | ||
// chartHeight: PropTypes.number, | ||
// data: PropTypes.shape({ | ||
// firstVoteTimes: PropTypes.arrayOf(PropTypes.number), | ||
// firstCommentTimes: PropTypes.arrayOf(PropTypes.number), | ||
// }), | ||
// } | ||
|
||
export default CommentersVoters | ||
// export default CommentersVoters |
185 changes: 94 additions & 91 deletions
185
client/src/pages/admin/stats/conversation-stats-vote-distribution.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,98 @@ | ||
import React from "react" | ||
import PropTypes from "prop-types" | ||
import { VictoryChart } from "victory-chart" | ||
import { VictoryBar } from "victory-bar" | ||
import { VictoryAxis } from "victory-axis" | ||
// /** @jsx jsx */ | ||
|
||
class VotesDistribution extends React.Component< | ||
{ | ||
chartWidth: number | ||
chartHeight: number | ||
data: { | ||
votesHistogram: Array<{ n_votes: number; n_ptpts: number }> | ||
} | ||
}, | ||
{} | ||
> { | ||
static propTypes: { | ||
chartWidth: unknown | ||
chartHeight: unknown | ||
data: object | ||
} | ||
// import React from "react" | ||
// import PropTypes from "prop-types" | ||
// import { VictoryChart } from "victory-chart" | ||
// import { VictoryBar } from "victory-bar" | ||
// import { VictoryAxis } from "victory-axis" | ||
// import { jsx } from "theme-ui" | ||
|
||
render() { | ||
return ( | ||
<VictoryChart width={this.props.chartWidth} height={this.props.chartHeight}> | ||
<VictoryAxis | ||
tickCount={7} | ||
label="Vote count" | ||
style={{ | ||
data: { | ||
axis: { | ||
stroke: "black", | ||
strokeWidth: 1, | ||
}, | ||
ticks: { | ||
stroke: "transparent", | ||
}, | ||
tickLabels: { | ||
fill: "black", | ||
}, | ||
}, | ||
}} | ||
/> | ||
<VictoryAxis | ||
label="Participant count" | ||
orientation={"left"} | ||
dependentAxis | ||
style={{ | ||
data: { | ||
axis: { | ||
stroke: "black", | ||
strokeWidth: 1, | ||
}, | ||
ticks: { | ||
stroke: "transparent", | ||
}, | ||
tickLabels: { | ||
fill: "black", | ||
}, | ||
}, | ||
}} | ||
/> | ||
<VictoryBar | ||
style={{ | ||
data: { | ||
fill: "cornflowerblue", | ||
width: 1, | ||
}, | ||
}} | ||
data={this.props.data.votesHistogram.map((d) => { | ||
return { | ||
x: d.n_votes, | ||
y: d.n_ptpts, | ||
} | ||
})} | ||
/> | ||
</VictoryChart> | ||
) | ||
} | ||
} | ||
// class VotesDistribution extends React.Component< | ||
// { | ||
// chartWidth: number | ||
// chartHeight: number | ||
// data: { | ||
// votesHistogram: Array<{ n_votes: number; n_ptpts: number }> | ||
// } | ||
// }, | ||
// {} | ||
// > { | ||
// static propTypes: { | ||
// chartWidth: unknown | ||
// chartHeight: unknown | ||
// data: object | ||
// } | ||
|
||
VotesDistribution.propTypes = { | ||
chartWidth: PropTypes.number, | ||
chartHeight: PropTypes.number, | ||
data: PropTypes.shape({ | ||
votesHistogram: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
n_votes: PropTypes.number, | ||
n_ptpts: PropTypes.number, | ||
}) | ||
), | ||
}), | ||
} | ||
// render() { | ||
// return ( | ||
// <VictoryChart width={this.props.chartWidth} height={this.props.chartHeight}> | ||
// <VictoryAxis | ||
// tickCount={7} | ||
// label="Vote count" | ||
// style={{ | ||
// data: { | ||
// axis: { | ||
// stroke: "black", | ||
// strokeWidth: 1, | ||
// }, | ||
// ticks: { | ||
// stroke: "transparent", | ||
// }, | ||
// tickLabels: { | ||
// fill: "black", | ||
// }, | ||
// }, | ||
// }} | ||
// /> | ||
// <VictoryAxis | ||
// label="Participant count" | ||
// orientation={"left"} | ||
// dependentAxis | ||
// style={{ | ||
// data: { | ||
// axis: { | ||
// stroke: "black", | ||
// strokeWidth: 1, | ||
// }, | ||
// ticks: { | ||
// stroke: "transparent", | ||
// }, | ||
// tickLabels: { | ||
// fill: "black", | ||
// }, | ||
// }, | ||
// }} | ||
// /> | ||
// <VictoryBar | ||
// style={{ | ||
// data: { | ||
// fill: "cornflowerblue", | ||
// width: 1, | ||
// }, | ||
// }} | ||
// data={this.props.data.votesHistogram.map((d) => { | ||
// return { | ||
// x: d.n_votes, | ||
// y: d.n_ptpts, | ||
// } | ||
// })} | ||
// /> | ||
// </VictoryChart> | ||
// ) | ||
// } | ||
// } | ||
|
||
export default VotesDistribution | ||
// VotesDistribution.propTypes = { | ||
// chartWidth: PropTypes.number, | ||
// chartHeight: PropTypes.number, | ||
// data: PropTypes.shape({ | ||
// votesHistogram: PropTypes.arrayOf( | ||
// PropTypes.shape({ | ||
// n_votes: PropTypes.number, | ||
// n_ptpts: PropTypes.number, | ||
// }) | ||
// ), | ||
// }), | ||
// } | ||
|
||
// export default VotesDistribution |