Commit 3ce3aea
Changed files (4)
product
desktop.ui
product/desktop.ui/presenters/TaxesForFamily.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using solidware.financials.windows.ui.model;
using solidware.financials.windows.ui.views.controls;
@@ -13,11 +14,13 @@ namespace solidware.financials.windows.ui.presenters
Income = Money.Null;
ProvincialTaxes = Money.Null;
FederalTaxes = Money.Null;
+ Chart = new ObservableCollection<KeyValuePair<string, decimal>>();
}
public Observable<Money> Income { get; set; }
public Observable<Money> ProvincialTaxes { get; set; }
public Observable<Money> FederalTaxes { get; set; }
+ public ICollection<KeyValuePair<string, decimal>> Chart { get; set; }
public TaxesForIndividual TaxesFor(Guid id)
{
@@ -32,6 +35,16 @@ namespace solidware.financials.windows.ui.presenters
Income.Value = family.Values.Sum(x => x.Income.Value);
ProvincialTaxes.Value = family.Values.Sum(x => x.ProvincialTaxes.Taxes.Value);
FederalTaxes.Value = family.Values.Sum(x => x.FederalTaxes.Taxes.Value);
+
+ RefreshChart();
+ }
+
+ void RefreshChart()
+ {
+ Chart.Clear();
+ Chart.Add(new KeyValuePair<string, decimal>("Income", Income.Value));
+ Chart.Add(new KeyValuePair<string, decimal>("Federal", FederalTaxes.Value));
+ Chart.Add(new KeyValuePair<string, decimal>("Provincial", ProvincialTaxes.Value));
}
IDictionary<Guid, TaxesForIndividual> family = new Dictionary<Guid, TaxesForIndividual>();
product/desktop.ui/views/TaxSummaryTab.xaml
@@ -2,8 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" >
- <DockPanel MinWidth="1024">
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" mc:Ignorable="d" >
+ <DockPanel MinWidth="1024" MinHeight="768">
<StackPanel>
<StackPanel Margin="5,5,5,5">
<Label FontWeight="Bold">Income</Label>
@@ -61,6 +61,12 @@
</StackPanel>
</GroupBox>
</DockPanel>
+ <StackPanel>
+ <Label>Family</Label>
+ <Charting:Chart VerticalContentAlignment="Stretch" Height="300">
+ <Charting:PieSeries ItemsSource="{Binding Path=Family.Chart}" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"></Charting:PieSeries>
+ </Charting:Chart>
+ </StackPanel>
</StackPanel>
</DockPanel>
</UserControl>
\ No newline at end of file
product/desktop.ui/views/TaxSummaryTab.xaml.cs
@@ -12,6 +12,29 @@ namespace solidware.financials.windows.ui.views
public void bind_to(TaxSummaryPresenter presenter)
{
DataContext = presenter;
+ //((LineSeries)Chart.Series[0]).ItemsSource = Data();
+ //Chart.Series.Add(new BarSeries
+ // {
+ // Title = "Federal Taxes",
+ // IndependentValueBinding = new Binding("Key"),
+ // DependentValueBinding = new Binding("Value"),
+ // ItemsSource = Data()
+ // });
+ //((PieSeries)Chart.Series[0]).ItemsSource = PieData();
}
+
+ //IEnumerable PieData()
+ //{
+ // yield return new KeyValuePair<string, decimal>("Federal", 12345.67m);
+ // yield return new KeyValuePair<string, decimal>("Provincial", 2345.67m);
+ // yield return new KeyValuePair<string, decimal>("Income", 345.67m);
+ //}
+
+ //IEnumerable<KeyValuePair<DateTime, decimal>> Data()
+ //{
+ // yield return new KeyValuePair<DateTime, decimal>(new DateTime(2011, 01, 01), 12345.67m);
+ // yield return new KeyValuePair<DateTime, decimal>(new DateTime(2011, 02, 01), 2345.67m);
+ // yield return new KeyValuePair<DateTime, decimal>(new DateTime(2011, 03, 01), 345.67m);
+ //}
}
}
\ No newline at end of file
product/desktop.ui/solidware.financials.csproj
@@ -93,6 +93,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
+ <Reference Include="System.Windows.Controls.DataVisualization.Toolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />