From cdf17645652a163ee31d94c121be899afafb12e5 Mon Sep 17 00:00:00 2001 From: John Mazzitelli Date: Fri, 20 Apr 2018 16:25:45 -0400 Subject: [PATCH] don't pass in percentages anymore - we are using a bar chart not pie chart so we should give it raw numbers. --- .../SummaryPanel/InOutRateChart.tsx | 43 ++++++++++--------- .../SummaryPanel/InOutRateTable.tsx | 26 ++++------- src/components/SummaryPanel/RateChart.tsx | 27 ++++++------ src/components/SummaryPanel/RateTable.tsx | 13 +++--- 4 files changed, 54 insertions(+), 55 deletions(-) diff --git a/src/components/SummaryPanel/InOutRateChart.tsx b/src/components/SummaryPanel/InOutRateChart.tsx index 13d127a826..a1e72bd852 100644 --- a/src/components/SummaryPanel/InOutRateChart.tsx +++ b/src/components/SummaryPanel/InOutRateChart.tsx @@ -2,14 +2,14 @@ import * as React from 'react'; import { StackedBarChart } from 'patternfly-react'; type InOutRateChartPropType = { - percent2xxIn: number; - percent3xxIn: number; - percent4xxIn: number; - percent5xxIn: number; - percent2xxOut: number; - percent3xxOut: number; - percent4xxOut: number; - percent5xxOut: number; + value2xxIn: number; + value3xxIn: number; + value4xxIn: number; + value5xxIn: number; + value2xxOut: number; + value3xxOut: number; + value4xxOut: number; + value5xxOut: number; width?: number; height?: number; showLegend?: boolean; @@ -18,14 +18,14 @@ type InOutRateChartPropType = { export default class InOutRateChart extends React.Component { static defaultProps: InOutRateChartPropType = { - percent2xxIn: 0, - percent3xxIn: 0, - percent4xxIn: 0, - percent5xxIn: 0, - percent2xxOut: 0, - percent3xxOut: 0, - percent4xxOut: 0, - percent5xxOut: 0, + value2xxIn: 0, + value3xxIn: 0, + value4xxIn: 0, + value5xxIn: 0, + value2xxOut: 0, + value3xxOut: 0, + value4xxOut: 0, + value5xxOut: 0, height: 150, showLegend: true, legendPos: 'bottom' @@ -53,15 +53,18 @@ export default class InOutRateChart extends React.Component @@ -73,14 +65,14 @@ export default class InOutRateTable extends React.Component diff --git a/src/components/SummaryPanel/RateChart.tsx b/src/components/SummaryPanel/RateChart.tsx index 4b27e5bc17..5c479359dd 100644 --- a/src/components/SummaryPanel/RateChart.tsx +++ b/src/components/SummaryPanel/RateChart.tsx @@ -2,10 +2,10 @@ import * as React from 'react'; import { StackedBarChart } from 'patternfly-react'; type RateChartPropType = { - percent2xx: number; - percent3xx: number; - percent4xx: number; - percent5xx: number; + value2xx: number; + value3xx: number; + value4xx: number; + value5xx: number; width?: number; height?: number; showLegend?: boolean; @@ -14,10 +14,10 @@ type RateChartPropType = { export default class RateChart extends React.Component { static defaultProps: RateChartPropType = { - percent2xx: 0, - percent3xx: 0, - percent4xx: 0, - percent5xx: 0, + value2xx: 0, + value3xx: 0, + value4xx: 0, + value5xx: 0, height: 100, showLegend: true, legendPos: 'bottom' @@ -45,15 +45,18 @@ export default class RateChart extends React.Component { x: { categories: [''], type: 'category' + }, + y: { + show: false } }} data={{ groups: [['OK', '3xx', '4xx', '5xx']], columns: [ - ['OK', this.props.percent2xx], - ['3xx', this.props.percent3xx], - ['4xx', this.props.percent4xx], - ['5xx', this.props.percent5xx] + ['OK', this.props.value2xx], + ['3xx', this.props.value3xx], + ['4xx', this.props.value4xx], + ['5xx', this.props.value5xx] ], // order: 'asc', colors: { diff --git a/src/components/SummaryPanel/RateTable.tsx b/src/components/SummaryPanel/RateTable.tsx index 89d7f160d3..7c4837cc4d 100644 --- a/src/components/SummaryPanel/RateTable.tsx +++ b/src/components/SummaryPanel/RateTable.tsx @@ -16,13 +16,9 @@ export default class RateTable extends React.Component { const percentErr: number = this.props.rate === 0 ? 0 : errRate / this.props.rate * 100; const successErr: number = 100 - percentErr; - // for the pie chart + // for the bar chart const rate2xx: number = this.props.rate === 0 ? 0 : this.props.rate - this.props.rate3xx - this.props.rate4xx - this.props.rate5xx; - const percent2xx: number = this.props.rate === 0 ? 0 : rate2xx / this.props.rate * 100; - const percent3xx: number = this.props.rate === 0 ? 0 : this.props.rate3xx / this.props.rate * 100; - const percent4xx: number = this.props.rate === 0 ? 0 : this.props.rate4xx / this.props.rate * 100; - const percent5xx: number = this.props.rate === 0 ? 0 : this.props.rate5xx / this.props.rate * 100; return (
@@ -43,7 +39,12 @@ export default class RateTable extends React.Component { - +
); }