Refactor chart

This commit is contained in:
Thomas Nordquist
2019-07-13 15:57:30 +02:00
parent 7c63e871f0
commit b5d9ff3067
13 changed files with 274 additions and 238 deletions

View File

@@ -1,6 +1,6 @@
import * as q from '../../../../backend/src/Model'
import React from 'react'
import Chart from './Chart'
import TopicChart from './TopicChart'
import { ChartParameters } from '../../reducers/Charts'
import { usePollingToFetchTreeNode } from '../helper/usePollingToFetchTreeNode'
@@ -16,5 +16,5 @@ export function ChartWithTreeNode(props: Props) {
}
const treeNode = usePollingToFetchTreeNode(tree, parameters.topic)
return <Chart treeNode={treeNode} parameters={parameters} />
return <TopicChart treeNode={treeNode} parameters={parameters} />
}

View File

@@ -51,7 +51,7 @@ function useMessageSubscriptionToUpdate(treeNode?: q.TreeNode<any>) {
return messageHistory
}
function Chart(props: Props) {
function TopicChart(props: Props) {
const { parameters, treeNode } = props
const [frozenHistory, setFrozenHistory] = React.useState<q.MessageHistory | undefined>()
const messageHistory = useMessageSubscriptionToUpdate(treeNode)
@@ -108,4 +108,4 @@ const mapDispatchToProps = (dispatch: any) => {
export default connect(
undefined,
mapDispatchToProps
)(Chart)
)(TopicChart)