|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" |
| 4 | + x:Class="DualBarChartDemo.MainPage" |
| 5 | + xmlns:syncfusion="clr-namespace:Syncfusion.Maui.Toolkit.Charts;assembly=Syncfusion.Maui.Toolkit" |
| 6 | + xmlns:local="clr-namespace:DualBarChartDemo"> |
| 7 | + |
| 8 | + <ContentPage.BindingContext> |
| 9 | + <local:ChartViewModel /> |
| 10 | + </ContentPage.BindingContext> |
| 11 | + |
| 12 | + <ContentPage.Resources> |
| 13 | + <x:String x:Key="PathData" >M14.958001,14.880005C11.712001,15.658997 8.1829996,17.106995 7.4849997,19.033997 7.2039995,19.811005 7.4359999,20.733002 8.1600008,21.779007L10.726001,19.212997 12.006,20.494003 9.6400003,22.858994C10.162,23.057999,10.645,23.169006,11.071,23.169006L11.072,23.169006C11.734,23.169006 12.251,22.944 12.748,22.436996 14.151,21.003006 14.794,17.789993 14.958001,14.880005z M17.013,12.417999L17,13.643005C16.977001,15.863998 16.656002,21.304001 14.177001,23.835999 13.31,24.720993 12.266,25.169006 11.072,25.169006 10.174001,25.169006 9.1820002,24.891998 8.1260004,24.373001L5.2629995,27.237 3.9819994,25.957001 6.729001,23.210007C5.4420004,21.492004 5.059001,19.860992 5.604001,18.354004 6.915,14.729996 13.179,13.158005 15.811,12.651001z M2,11L2,30 20,30 20,11z M2,2L2,8 20,8 20,2z M0,0L22,0 22,8.1670074 22,11 22,24.843994 25,21.311996 25,9 29.313,3.6880035 31.710999,6.125 28,10.796997 28,23 22,28.990005 22,32 0,32 0,11 0,8.1670074z</x:String> |
| 14 | + </ContentPage.Resources> |
| 15 | + |
| 16 | + <Border Margin="{OnPlatform Android=10,Default=25,iOS=10}" |
| 17 | + StrokeThickness="1" Stroke="Black" |
| 18 | + StrokeShape="RoundRectangle 15"> |
| 19 | + |
| 20 | + <syncfusion:SfCartesianChart HorizontalOptions="Fill" |
| 21 | + VerticalOptions="Fill" |
| 22 | + Margin="{OnPlatform Android=5,Default=15,iOS=5}"> |
| 23 | + <syncfusion:SfCartesianChart.Resources> |
| 24 | + <DataTemplate x:Key="tooltipTemplate" > |
| 25 | + <Border BackgroundColor="#7bb4eb" |
| 26 | + Padding="8, 3, 8, 3" |
| 27 | + Stroke="Transparent"> |
| 28 | + <StackLayout Orientation="Horizontal"> |
| 29 | + <Label Text="{Binding Item.year, StringFormat='{}{0:yyyy}'}" |
| 30 | + TextColor="Black" |
| 31 | + FontSize="14" |
| 32 | + HorizontalOptions="Center" |
| 33 | + VerticalOptions="Center"/> |
| 34 | + <Label Text=" : " |
| 35 | + TextColor="Black" |
| 36 | + FontAttributes="Bold" |
| 37 | + FontSize="14" |
| 38 | + HorizontalOptions="Center" |
| 39 | + VerticalOptions="Center"/> |
| 40 | + <BoxView WidthRequest="5" |
| 41 | + BackgroundColor="Transparent"/> |
| 42 | + <Label Text="{Binding Item.yValue}" |
| 43 | + TextColor="Black" |
| 44 | + FontSize="14" |
| 45 | + HorizontalOptions="Center" |
| 46 | + VerticalOptions="Center"/> |
| 47 | + </StackLayout> |
| 48 | + </Border> |
| 49 | + </DataTemplate> |
| 50 | + </syncfusion:SfCartesianChart.Resources> |
| 51 | + <syncfusion:SfCartesianChart.Title> |
| 52 | + <Grid Padding="35,0,0,10"> |
| 53 | + <Grid.ColumnDefinitions> |
| 54 | + <ColumnDefinition Width="Auto"/> |
| 55 | + <ColumnDefinition Width="*" /> |
| 56 | + </Grid.ColumnDefinitions> |
| 57 | + <Path Grid.Column="0" |
| 58 | + Data="{StaticResource PathData}" |
| 59 | + Fill="Black" |
| 60 | + Stroke="Gray" |
| 61 | + StrokeThickness="1" |
| 62 | + HeightRequest="40" |
| 63 | + WidthRequest="40" |
| 64 | + VerticalOptions="Center"/> |
| 65 | + |
| 66 | + <StackLayout Grid.Column="1" Orientation="Vertical" HorizontalOptions="Start"> |
| 67 | + <Label Text="Building Variance Indicators in .NET MAUI Toolkit Charts to Visualize Natural Gas Price Volatility" |
| 68 | + FontAttributes="Bold" |
| 69 | + FontSize="{OnPlatform Android=12,Default=16,iOS=12}" /> |
| 70 | + <Label Text="Natural Gas Price Volatility Analysis 2014-2023" |
| 71 | + FontSize="{OnPlatform Android=10,Default=12,iOS=10}" /> |
| 72 | + </StackLayout> |
| 73 | + </Grid> |
| 74 | + </syncfusion:SfCartesianChart.Title> |
| 75 | + |
| 76 | + <syncfusion:SfCartesianChart.TooltipBehavior> |
| 77 | + <syncfusion:ChartTooltipBehavior Background="#7bb4eb" /> |
| 78 | + </syncfusion:SfCartesianChart.TooltipBehavior> |
| 79 | + |
| 80 | + <syncfusion:SfCartesianChart.XAxes> |
| 81 | + <syncfusion:DateTimeAxis Interval="2" IntervalType="Years" > |
| 82 | + <syncfusion:DateTimeAxis.Title> |
| 83 | + <syncfusion:ChartAxisTitle Text="Time Period (Years)" /> |
| 84 | + </syncfusion:DateTimeAxis.Title> |
| 85 | + <syncfusion:DateTimeAxis.MajorTickStyle> |
| 86 | + <syncfusion:ChartAxisTickStyle Stroke="Transparent" TickSize="0" /> |
| 87 | + </syncfusion:DateTimeAxis.MajorTickStyle> |
| 88 | + <syncfusion:DateTimeAxis.AxisLineStyle> |
| 89 | + <syncfusion:ChartLineStyle Stroke="#888888" StrokeWidth="1"/> |
| 90 | + </syncfusion:DateTimeAxis.AxisLineStyle> |
| 91 | + </syncfusion:DateTimeAxis> |
| 92 | + </syncfusion:SfCartesianChart.XAxes> |
| 93 | + |
| 94 | + <syncfusion:SfCartesianChart.YAxes> |
| 95 | + <syncfusion:NumericalAxis Interval="1" > |
| 96 | + <syncfusion:NumericalAxis.Title> |
| 97 | + <syncfusion:ChartAxisTitle Text="Price (USD per Million BTU)" /> |
| 98 | + </syncfusion:NumericalAxis.Title> |
| 99 | + <syncfusion:NumericalAxis.MajorTickStyle> |
| 100 | + <syncfusion:ChartAxisTickStyle Stroke="Transparent" TickSize="0" /> |
| 101 | + </syncfusion:NumericalAxis.MajorTickStyle> |
| 102 | + <syncfusion:NumericalAxis.AxisLineStyle> |
| 103 | + <syncfusion:ChartLineStyle StrokeWidth="1" /> |
| 104 | + </syncfusion:NumericalAxis.AxisLineStyle> |
| 105 | + |
| 106 | + </syncfusion:NumericalAxis> |
| 107 | + </syncfusion:SfCartesianChart.YAxes> |
| 108 | + |
| 109 | + <syncfusion:SfCartesianChart.Series> |
| 110 | + <syncfusion:ColumnSeries ItemsSource="{Binding Data}" |
| 111 | + XBindingPath="year" |
| 112 | + YBindingPath="yValue" |
| 113 | + EnableTooltip="True" |
| 114 | + Fill="#7bb4eb" |
| 115 | + ShowDataLabels="False" |
| 116 | + TooltipTemplate="{StaticResource tooltipTemplate}" |
| 117 | + Label="Column Value"> |
| 118 | + </syncfusion:ColumnSeries> |
| 119 | + <local:RangeColumnSeriesExt ItemsSource="{Binding Data}" |
| 120 | + XBindingPath="year" |
| 121 | + High="high" |
| 122 | + Low="low" |
| 123 | + EnableTooltip="False" /> |
| 124 | + </syncfusion:SfCartesianChart.Series> |
| 125 | + </syncfusion:SfCartesianChart> |
| 126 | + </Border> |
| 127 | +</ContentPage> |
0 commit comments