Skip to content

Commit

Permalink
handle unused charts
Browse files Browse the repository at this point in the history
  • Loading branch information
raykyri committed May 21, 2023
1 parent 05462a4 commit fca26a5
Show file tree
Hide file tree
Showing 2 changed files with 168 additions and 165 deletions.
148 changes: 74 additions & 74 deletions client/src/pages/admin/stats/conversation-stats-commenters-voters.tsx
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 client/src/pages/admin/stats/conversation-stats-vote-distribution.tsx
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

0 comments on commit fca26a5

Please sign in to comment.