-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
404 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
FluentWeather.OpenMeteoProvider/Models/OpenMeteoHourlyForecast.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
FluentWeather.Uwp.QWeatherProvider/Models/QWeatherHourlyForecast.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<UserControl | ||
x:Class="FluentWeather.Uwp.Controls.HourlyDataChart" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:chart="using:Telerik.UI.Xaml.Controls.Chart" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:FluentWeather.Uwp.Controls" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:valueConverters="using:ValueConverters" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" | ||
mc:Ignorable="d"> | ||
|
||
<UserControl.Resources> | ||
<valueConverters:AddConverter x:Key="AddConverter" /> | ||
<DataTemplate x:Key="PointTemplate"> | ||
<Ellipse | ||
Width="8" | ||
Height="8" | ||
Fill="{ThemeResource SystemControlHighlightAltAltHighBrush}" | ||
Stroke="{ThemeResource SystemControlBackgroundBaseMediumHighBrush}" | ||
StrokeThickness="2" /> | ||
</DataTemplate> | ||
</UserControl.Resources> | ||
<Grid> | ||
<chart:RadCartesianChart> | ||
<chart:RadCartesianChart.HorizontalAxis> | ||
<chart:CategoricalAxis | ||
x:Uid="TimeAxis" | ||
LabelFormat="{}{0,0:HH:00}" | ||
MajorTickInterval="3" | ||
PlotMode="OnTicksPadded" /> | ||
</chart:RadCartesianChart.HorizontalAxis> | ||
<chart:RadCartesianChart.VerticalAxis> | ||
<chart:LinearAxis | ||
x:Name="VerticalLinearAxis" | ||
HorizontalLocation="Left" | ||
LabelFormat="{x:Bind LabelFormat, Mode=OneWay}"> | ||
<chart:LinearAxis.LineStyle> | ||
<Style TargetType="Line"> | ||
<Setter Property="Stroke" Value="Transparent" /> | ||
</Style> | ||
</chart:LinearAxis.LineStyle> | ||
<chart:LinearAxis.MajorTickStyle> | ||
<Style TargetType="Rectangle"> | ||
<Setter Property="Stroke" Value="Transparent" /> | ||
</Style> | ||
</chart:LinearAxis.MajorTickStyle> | ||
</chart:LinearAxis> | ||
</chart:RadCartesianChart.VerticalAxis> | ||
|
||
<chart:RadCartesianChart.Grid> | ||
<chart:CartesianChartGrid MajorLinesVisibility="Y" /> | ||
</chart:RadCartesianChart.Grid> | ||
<chart:SplineAreaSeries | ||
chart:ChartTrackBallBehavior.IntersectionTemplate="{x:Bind IntersectionTemplate, Mode=OneWay}" | ||
chart:ChartTrackBallBehavior.TrackInfoTemplate="{x:Bind TrackInfoTemplate, Mode=OneWay}" | ||
ClipToPlotArea="False" | ||
CombineMode="Cluster" | ||
ItemsSource="{x:Bind HourlyForecasts, Mode=OneWay}" | ||
Stroke="{ThemeResource SystemControlBackgroundBaseHighBrush}" | ||
StrokeThickness="3"> | ||
<chart:SplineAreaSeries.Fill> | ||
<LinearGradientBrush Opacity="0.4" StartPoint="0.5,0" EndPoint="0.5,1"> | ||
<GradientStop Offset="0" Color="{ThemeResource SystemBaseHighColor}" /> | ||
<GradientStop Offset="1" Color="Transparent" /> | ||
</LinearGradientBrush> | ||
</chart:SplineAreaSeries.Fill> | ||
<chart:SplineAreaSeries.LabelDefinitions> | ||
<chart:ChartSeriesLabelDefinition | ||
Margin="0,8,0,0" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" /> | ||
</chart:SplineAreaSeries.LabelDefinitions> | ||
<chart:SplineAreaSeries.CategoryBinding> | ||
<chart:PropertyNameDataPointBinding PropertyName="Time" /> | ||
</chart:SplineAreaSeries.CategoryBinding> | ||
<chart:SplineAreaSeries.ValueBinding> | ||
<chart:PropertyNameDataPointBinding PropertyName="{x:Bind PropertyName, Mode=OneWay}" /> | ||
</chart:SplineAreaSeries.ValueBinding> | ||
</chart:SplineAreaSeries> | ||
<chart:RadCartesianChart.Behaviors> | ||
<chart:ChartTrackBallBehavior ShowInfo="False" ShowIntersectionPoints="True" /> | ||
</chart:RadCartesianChart.Behaviors> | ||
|
||
</chart:RadCartesianChart> | ||
|
||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
using FluentWeather.Abstraction.Models; | ||
using Telerik.UI.Xaml.Controls.Chart; | ||
|
||
//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板 | ||
|
||
namespace FluentWeather.Uwp.Controls | ||
{ | ||
public sealed partial class HourlyDataChart : UserControl | ||
{ | ||
public HourlyDataChart() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
public List<WeatherHourlyBase> HourlyForecasts | ||
{ | ||
get => ((List<WeatherHourlyBase>)GetValue(HourlyForecastsProperty)); | ||
set => SetValue(HourlyForecastsProperty, value); | ||
} | ||
|
||
|
||
public static readonly DependencyProperty HourlyForecastsProperty = | ||
DependencyProperty.Register(nameof(HourlyForecasts), typeof(List<WeatherHourlyBase>), typeof(HourlyDataChart), new PropertyMetadata(default)); | ||
|
||
public string PropertyName | ||
{ | ||
get => (string)GetValue(PropertyNameProperty); | ||
set => SetValue(PropertyNameProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty PropertyNameProperty = | ||
DependencyProperty.Register(nameof(PropertyName), typeof(string), typeof(HourlyDataChart), new PropertyMetadata(default)); | ||
|
||
|
||
public double Minimum | ||
{ | ||
get => (double)GetValue(MinimumProperty); | ||
set => SetValue(MinimumProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty MinimumProperty = | ||
DependencyProperty.Register(nameof(Minimum), typeof(double), typeof(HourlyDataChart), new PropertyMetadata(default, OnPropertyChanged)); | ||
|
||
public double Maximum | ||
{ | ||
get => (double)GetValue(MaximumProperty); | ||
set => SetValue(MaximumProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty MaximumProperty = | ||
DependencyProperty.Register(nameof(Maximum), typeof(double), typeof(HourlyDataChart), new PropertyMetadata(default, OnPropertyChanged)); | ||
|
||
public double MajorStep | ||
{ | ||
get => (double)GetValue(MajorStepProperty); | ||
set => SetValue(MajorStepProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty MajorStepProperty = | ||
DependencyProperty.Register(nameof(MajorStep), typeof(double), typeof(HourlyDataChart), new PropertyMetadata(default, OnPropertyChanged)); | ||
|
||
public DataTemplate TrackInfoTemplate | ||
{ | ||
get => (DataTemplate)GetValue(TrackInfoTemplateProperty); | ||
set => SetValue(TrackInfoTemplateProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty TrackInfoTemplateProperty = | ||
DependencyProperty.Register(nameof(TrackInfoTemplateProperty), typeof(DataTemplate), typeof(HourlyDataChart), new PropertyMetadata(default)); | ||
|
||
public DataTemplate IntersectionTemplate | ||
{ | ||
get => (DataTemplate)GetValue(IntersectionTemplateProperty); | ||
set => SetValue(IntersectionTemplateProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty IntersectionTemplateProperty = | ||
DependencyProperty.Register(nameof(IntersectionTemplateProperty), typeof(DataTemplate), typeof(HourlyDataChart), new PropertyMetadata(default)); | ||
|
||
public string LabelFormat | ||
{ | ||
get => (string)GetValue(LabelFormatProperty); | ||
set => SetValue(LabelFormatProperty, value); | ||
} | ||
|
||
public static readonly DependencyProperty LabelFormatProperty = | ||
DependencyProperty.Register(nameof(LabelFormat), typeof(string), typeof(HourlyTemperatureChart), new PropertyMetadata(default)); | ||
|
||
|
||
|
||
private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) | ||
{ | ||
var chart = (HourlyDataChart)d; | ||
//chart.Bindings.Update(); | ||
if (e.NewValue is default(double)) return; | ||
if(e.Property == MinimumProperty) | ||
{ | ||
chart.VerticalLinearAxis.Minimum = (double)e.NewValue; | ||
} | ||
if (e.Property == MaximumProperty) | ||
{ | ||
chart.VerticalLinearAxis.Maximum = (double)e.NewValue; | ||
} | ||
if (e.Property == MajorStepProperty) | ||
{ | ||
chart.VerticalLinearAxis.MajorStep = (double)e.NewValue; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.