diff --git a/src/FS.FluentUI.Charts/Charts.fs b/src/FS.FluentUI.Charts/Charts.fs index f5fdaa3..965d48e 100644 --- a/src/FS.FluentUI.Charts/Charts.fs +++ b/src/FS.FluentUI.Charts/Charts.fs @@ -34,4 +34,5 @@ type Fui = let args = color, isDarkTheme import "getColorFromToken" "@fluentui/react-charts" (emitJsExpr args "$0[0], $0[1]") static member inline legends (props: ILegendsProp list) = Helpers.createElement (import "Legends" "@fluentui/react-charts") props + static member inline responsiveContainer (props : IResponsiveContainerProp list) = Helpers.createElement (import "ResponsiveContainer" "@fluentui/react-charts") props diff --git a/src/FS.FluentUI.Charts/Props.fs b/src/FS.FluentUI.Charts/Props.fs index 77445bb..a60c02a 100644 --- a/src/FS.FluentUI.Charts/Props.fs +++ b/src/FS.FluentUI.Charts/Props.fs @@ -3970,3 +3970,15 @@ module polarChart = static member inline clockwise = Interop.mkProperty "direction" "clockwise" /// Direction in which the chart is drawn. static member inline counterclockwise = Interop.mkProperty "direction" "counterclockwise" + + +// ------------------------------------------------------------- ResponsiveContainer ------------------------------------------ + +type [] responsiveContainer = + static member inline aspect (value: float) = Interop.mkProperty "aspect" value + static member inline children (value: ReactElement) = Interop.mkProperty "children" value + static member inline children (values: ReactElement seq) = Interop.mkProperty "children" values + static member inline height (value: int) = Interop.mkProperty "height" value + static member inline minWidth (value: int) = Interop.mkProperty "minWidth" value + static member inline minHeight (value: int) = Interop.mkProperty "minHeight" value + static member inline width (value: int) = Interop.mkProperty "width" value diff --git a/src/FS.FluentUI.Charts/Utils.fs b/src/FS.FluentUI.Charts/Utils.fs index 2ecb4c3..2e7b47e 100644 --- a/src/FS.FluentUI.Charts/Utils.fs +++ b/src/FS.FluentUI.Charts/Utils.fs @@ -106,3 +106,4 @@ type [] IScatterPolarSeriesProp = interface end type [] IPolarChartStylesProp = interface end type [] IPolarAxisProp = interface end type [] IAxisProp = interface end +type [] IResponsiveContainerProp = interface end diff --git a/src/FS.FluentUI.TestGrounds/src/TestCharts.fs b/src/FS.FluentUI.TestGrounds/src/TestCharts.fs index 3da7dd4..9329917 100644 --- a/src/FS.FluentUI.TestGrounds/src/TestCharts.fs +++ b/src/FS.FluentUI.TestGrounds/src/TestCharts.fs @@ -837,7 +837,10 @@ let polarChartData = [ let TestChartsComponent () = let sliderValue, setSliderValue = React.useState 50 Html.div [ - prop.style [ style.width 1000; style.margin 36 ] + prop.style [ + style.width (length.perc 100) + style.margin 36 + ] prop.children [ Fui.polarChart [ polarChart.data polarChartData @@ -846,6 +849,33 @@ let TestChartsComponent () = polarChart.shape.polygon polarChart.direction.clockwise ] + Fui.responsiveContainer [ + responsiveContainer.children [ + + Fui.areaChart [ + areaChart.mode.tonexty + areaChart.height 300 + areaChart.width 600 + areaChart.legendsOverflowText "Overflow Items" + areaChart.yAxisTickFormat (fun (s:string) -> "$" + s) + areaChart.svgProps [ prop.ariaLabel "This is another test?!"] + areaChart.enableGradient true + areaChart.enablePerfOptimization true + areaChart.reflowProps.modeNone + areaChart.xAxis.tickStep 5 + areaChart.xAxis.tick0 5 + areaChart.legendProps [ + legends.allowFocusOnLegends true + legends.canSelectMultipleLegends true + legends.centerLegends true + ] + areaChart.data [ + chart.chartTitle "Areachart in responsive container" + chart.lineChartData areaChartDataList + ] + ] + ] + ] Fui.areaChart [ areaChart.mode.tonexty areaChart.height 300