1515 */
1616
1717import React from "react"
18+ import { Tile } from "@patternfly/react-core"
19+
1820import {
1921 Chart ,
2022 ChartProps ,
@@ -63,7 +65,7 @@ interface Props {
6365}
6466
6567export default class BaseChart extends React . PureComponent < Props > {
66- private static fontSize = 7
68+ private static fontSize = 9
6769 private static tickLabelFontSize = BaseChart . fontSize - 1
6870
6971 private static readonly dimensions = {
@@ -72,10 +74,10 @@ export default class BaseChart extends React.PureComponent<Props> {
7274 }
7375
7476 public static readonly padding = {
75- bottom : BaseChart . fontSize * 3 ,
76- top : BaseChart . fontSize * 5.5 ,
77- left : BaseChart . fontSize * 4.25 ,
78- right : BaseChart . fontSize * 4.25 ,
77+ bottom : BaseChart . fontSize * 2 ,
78+ top : BaseChart . fontSize * 4 ,
79+ left : BaseChart . fontSize * 4 ,
80+ right : BaseChart . fontSize * 4 ,
7981 }
8082
8183 public static readonly colors = [
@@ -123,7 +125,7 @@ export default class BaseChart extends React.PureComponent<Props> {
123125 fill : string ,
124126 fontSize = BaseChart . fontSize ,
125127 fontStyle = "italic" ,
126- fontWeight = 300
128+ fontWeight = 500
127129 ) : ChartLabelProps [ "style" ] {
128130 return { fontSize, fontStyle, fontWeight, fill }
129131 }
@@ -141,9 +143,12 @@ export default class BaseChart extends React.PureComponent<Props> {
141143 grid : { strokeWidth : 1 , stroke : "var(--color-text-02)" , strokeOpacity : 0.15 } ,
142144 } )
143145
144- private static readonly titleX = {
145- left : BaseChart . padding . left - BaseChart . tickLabelFontSize * 4 ,
146- right : BaseChart . dimensions . width - BaseChart . tickLabelFontSize * 2.5 ,
146+ private static readonly titlePosition = {
147+ x : {
148+ left : BaseChart . padding . left - BaseChart . tickLabelFontSize * 4 ,
149+ right : BaseChart . dimensions . width - BaseChart . tickLabelFontSize * 1.5 ,
150+ } ,
151+ y : BaseChart . padding . top - BaseChart . fontSize * 2 ,
147152 }
148153
149154 private static readonly formatters = {
@@ -175,7 +180,7 @@ export default class BaseChart extends React.PureComponent<Props> {
175180 private yAxis ( axis : BaseChartProps [ "yAxes" ] [ number ] ) {
176181 if ( axis ) {
177182 // re: the + BaseChart.fontSize * N: shift the axis labels over a bit, to overlap with the ticks
178- const x = axis . orientation === "right" ? BaseChart . titleX . right : BaseChart . titleX . left
183+ const x = axis . orientation === "right" ? BaseChart . titlePosition . x . right : BaseChart . titlePosition . x . left
179184
180185 const labelColor =
181186 axis . style && axis . style . tickLabels && typeof axis . style . tickLabels . fill === "string"
@@ -186,7 +191,7 @@ export default class BaseChart extends React.PureComponent<Props> {
186191 < ChartLabel
187192 key = "yAxisLabel"
188193 x = { x }
189- y = { BaseChart . padding . top - BaseChart . fontSize * 1.75 }
194+ y = { BaseChart . titlePosition . y }
190195 style = { BaseChart . axisLabelStyle ( labelColor ) }
191196 textAnchor = { axis . orientation === "right" ? "end" : "start" }
192197 text = { axis . label }
@@ -223,22 +228,11 @@ export default class BaseChart extends React.PureComponent<Props> {
223228 return this . lineStyle ( stroke , "3,0.5" , 2 )
224229 }
225230
226- private title ( chart : BaseChartProps ) {
227- return (
228- < ChartLabel
229- x = { BaseChart . titleX . left }
230- y = { BaseChart . fontSize * 1.5 }
231- style = { BaseChart . titleStyle ( ) }
232- text = { chart . title }
233- />
234- )
235- }
236-
237231 private chart ( chart : BaseChartProps , idx : number ) {
232+ // ariaTitle={chart.title}
238233 return (
239- < div className = "codeflare-chart-container" key = { idx } >
234+ < Tile className = "codeflare-chart-container" key = { idx } title = { chart . title } >
240235 < Chart
241- ariaTitle = { chart . title }
242236 ariaDesc = { chart . desc }
243237 padding = { chart . padding || BaseChart . padding }
244238 width = { BaseChart . dimensions . width }
@@ -258,7 +252,6 @@ export default class BaseChart extends React.PureComponent<Props> {
258252 />
259253 }
260254 >
261- { this . title ( chart ) }
262255 { this . xAxis ( ) }
263256 { chart . series . flatMap ( ( { impl, stroke, fill = stroke , data } , idx ) => {
264257 const yAxis =
@@ -294,7 +287,7 @@ export default class BaseChart extends React.PureComponent<Props> {
294287 }
295288 } ) }
296289 </ Chart >
297- </ div >
290+ </ Tile >
298291 )
299292 }
300293
0 commit comments