Esempio n. 1
0
 public void PieSeriesWithOneDouble()
 {
     KeyValuePair<string, double>[] objects = new KeyValuePair<string, double>[]
         {
             new KeyValuePair<string, double>("A", 90000.0)
         };
     Chart chart = new Chart();
     DataPointSeries pieSeries = DefaultSeriesToTest;
     chart.Series.Add(pieSeries);
     pieSeries.IndependentValueBinding = new Binding("Key");
     pieSeries.DependentValueBinding = new Binding("Value");
     TestAsync(
         chart,
         () => pieSeries.ItemsSource = objects,
         () => Assert.AreEqual(1, chart.LegendItems.Cast<object>().Count()),
         () =>
         {
             IList<PieDataPoint> pieDataPoints = ChartTestUtilities.GetDataPointsForSeries(pieSeries).Cast<PieDataPoint>().ToList();
             Assert.AreEqual(1, pieDataPoints.Count);
             PieDataPoint pieDataPoint = pieDataPoints[0];
             Assert.IsNotNull(pieDataPoint.Geometry);
             Assert.AreSame(typeof(EllipseGeometry), pieDataPoint.Geometry.GetType());
             Assert.IsNotNull(pieDataPoint.GeometryHighlight);
             Assert.AreSame(typeof(EllipseGeometry), pieDataPoint.GeometryHighlight.GetType());
             Assert.IsNotNull(pieDataPoint.GeometrySelection);
             Assert.AreSame(typeof(EllipseGeometry), pieDataPoint.GeometrySelection.GetType());
         });
 }
Esempio n. 2
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Facility.Reports;component/MainPage.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.mcChart    = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChart")));
     this.DownloadPatientsCostLink                      = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadPatientsCostLink")));
     this.mcChartAvgCD4                                 = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartAvgCD4")));
     this.DownloadPatientsCD4CostLink                   = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadPatientsCD4CostLink")));
     this.mcChartAvgExcludingCD4                        = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartAvgExcludingCD4")));
     this.DownloadPatientsExcludingCD4CostLink          = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadPatientsExcludingCD4CostLink")));
     this.mcChartAvgCostCoveredByProgramPatient         = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartAvgCostCoveredByProgramPatient")));
     this.DownloadAvgCostCoveredByProgramPatientLink    = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadAvgCostCoveredByProgramPatientLink")));
     this.mcChartArvAvgCostCoveredByProgramPatient      = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartArvAvgCostCoveredByProgramPatient")));
     this.DownloadArvAvgCostCoveredByProgramPatientLink = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadArvAvgCostCoveredByProgramPatientLink")));
     this.mcChartAvgARVandOI                            = ((System.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartAvgARVandOI")));
     this.series1 = ((Facility.Reports.StackedColumnSeries)(this.FindName("series1")));
     this.series2 = ((Facility.Reports.StackedColumnSeries)(this.FindName("series2")));
     this.DownloadAvgARVandOILink = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadAvgARVandOILink")));
     this.mcChartCumARVandOI      = ((System.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartCumARVandOI")));
     this.Cumseries1 = ((Facility.Reports.StackedColumnSeries)(this.FindName("Cumseries1")));
     this.Cumseries2 = ((Facility.Reports.StackedColumnSeries)(this.FindName("Cumseries2")));
     this.DownloadCumARVandOILink = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadCumARVandOILink")));
     this.mcChartCumCostCoveredByProgramPatient      = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartCumCostCoveredByProgramPatient")));
     this.DownloadCumCostCoveredByProgramPatientLink = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadCumCostCoveredByProgramPatientLink")));
     this.mcChartTotalCostLostToFollowup             = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartTotalCostLostToFollowup")));
     this.DownloadTotalCostLostToFollowupLink        = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadTotalCostLostToFollowupLink")));
     this.mcChartCumTotalCostLostToFollowup          = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChartCumTotalCostLostToFollowup")));
     this.DownloadCumTotalCostLostToFollowupLink     = ((System.Windows.Controls.HyperlinkButton)(this.FindName("DownloadCumTotalCostLostToFollowupLink")));
 }
Esempio n. 3
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Snf.Silver.ChartsAndReports;component/SalesDistribution.xaml", System.UriKind.Relative));
     this.FavoriteColorColumnChart = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("FavoriteColorColumnChart")));
 }
 public virtual void UseDateTimeValueAsDependentValue()
 {
     Chart chart = new Chart();
     DataPointSeriesWithAxes series = DataPointSeriesWithAxesToTest;
     DateTime[] dateTimes = new[] { DateTime.Now };
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => series.ItemsSource = dateTimes);
 }
Esempio n. 5
0
 public void SimpleChartOneIntegerValueZero()
 {
     DataPointSeries series = DefaultSeriesToTest;
     series.ItemsSource = new int[] { 0 };
     Chart chart = new Chart();
     chart.Series.Add(series);
     TestAsync(
         chart,
         () => Assert.AreEqual(1, ChartTestUtilities.GetDataPointsForSeries(series).Count));
 }
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Facility.Reports;component/DebitNote.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.mcChart    = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("mcChart")));
 }
Esempio n. 7
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/IQCare_Graphs;component/MainPage.xaml", System.UriKind.Relative));
     this.ctlGridChart = ((System.Windows.Controls.Grid)(this.FindName("ctlGridChart")));
     this.MFenollrd    = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("MFenollrd")));
 }
 public void AutomaticSeriesTitle()
 {
     Series series1 = DefaultSeriesToTest;
     Series series2 = DefaultSeriesToTest;
     Chart chart = new Chart();
     TestAsync(
         chart,
         () => chart.Series.Add(series1),
         () => chart.Series.Add(series2),
         () => Assert.AreEqual("Series 1", series1.Title),
         () => Assert.AreEqual("Series 2", series2.Title));
 }
Esempio n. 9
0
 public void DataPointSeriesAnimationLastToFirst()
 {
     Chart chart = new Chart();
     DataPointSeries series = DefaultDataPointSeriesToTest;
     series.IndependentValueBinding = new Binding();
     series.AnimationSequence = AnimationSequence.LastToFirst;
     TestAsync(
         chart,
         () => series.ItemsSource = new int[] { 1, 2, 3 },
         () => chart.Series.Add(series),
         () => series.Refresh());
 }
Esempio n. 10
0
 public void InitializeComponent() {
     if (_contentLoaded) {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/AccountBook;component/StoreChart.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.pageTitle = ((Microsoft.Phone.Controls.Pivot)(this.FindName("pageTitle")));
     this.chart1 = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("chart1")));
     this.PieChart1 = ((Microsoft.Windows.Controls.DataVisualization.Charting.PieSeries)(this.FindName("PieChart1")));
     this.chart2 = ((Microsoft.Windows.Controls.DataVisualization.Charting.Chart)(this.FindName("chart2")));
     this.ColumnSeries1 = ((Microsoft.Windows.Controls.DataVisualization.Charting.ColumnSeries)(this.FindName("ColumnSeries1")));
     this.listMouthReport = ((System.Windows.Controls.ListBox)(this.FindName("listMouthReport")));
 }
Esempio n. 11
0
 public void AddNewPointToCategoryAxis()
 {
     Chart chart = new Chart();
     DataPointSeries series = new ColumnSeries();
     series.IndependentValueBinding = new Binding();
     ObservableCollection<int> itemsSource = new ObservableCollection<int>();
     itemsSource.Add(5);
     series.ItemsSource = itemsSource;
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => itemsSource.Add(10),
         () => chart.Refresh());
 }
Esempio n. 12
0
 public void SetSeriesStyles()
 {
     Chart chart = new Chart();
     IList seriesStyles = new Style[] { new Style(typeof(Control)), new Style(typeof(Series)) };
     chart.StylePalette = seriesStyles;
     Assert.AreSame(seriesStyles, chart.StylePalette);
 }
Esempio n. 13
0
 public void TitleChangeObject()
 {
     Chart chart = new Chart();
     object title = new object();
     chart.Title = title;
     Assert.AreSame(title, chart.Title);
 }
Esempio n. 14
0
 public void TitleChangeButton()
 {
     Chart chart = new Chart();
     Button title = new Button { Content = "Button Title" };
     chart.Title = title;
     Assert.AreSame(title, chart.Title);
 }
Esempio n. 15
0
 public void SeriesRemoveOneSeries()
 {
     Chart chart = new Chart();
     DataPointSeries series = new ColumnSeries();
     series.ItemsSource = new int[] { 2, 4, 6 };
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => AssertSeriesCorrect(chart, series),
         () => chart.Series.Remove(series),
         () => AssertSeriesCorrect(chart),
         () => Assert.IsNull(series.SeriesHost));
 }
Esempio n. 16
0
 public void AxisInAxisCollection()
 {
     Chart chart = new Chart();
     DateTimeAxis dateTimeAxis = new DateTimeAxis();
     dateTimeAxis.Orientation = AxisOrientation.Horizontal;
     dateTimeAxis.IntervalType = DateTimeIntervalType.Days;
     dateTimeAxis.Interval = 1;
     chart.Axes.Add(dateTimeAxis);
     DataPointSeries series = new LineSeries();
     series.DependentValueBinding = new Binding("Day");
     series.IndependentValueBinding = new Binding();
     series.ItemsSource = new DateTime[] { new DateTime(2008, 1, 1), new DateTime(2008, 1, 2) };
     chart.Series.Add(series);
     TestAsync(
         chart,
         () => chart.Refresh());
 }
Esempio n. 17
0
 public void TitleChangeString()
 {
     Chart chart = new Chart();
     string title = "String Title";
     chart.Title = title;
     Assert.AreSame(title, chart.Title);
 }
Esempio n. 18
0
 public void PieSeriesWithThreeIntegers()
 {
     KeyValuePair<string, int>[] objects = new KeyValuePair<string, int>[]
         {
             new KeyValuePair<string, int>("A", 700),
             new KeyValuePair<string, int>("B", 800),
             new KeyValuePair<string, int>("C", 900),
         };
     Chart chart = new Chart();
     DataPointSeries pieSeries = DefaultSeriesToTest;
     chart.Series.Add(pieSeries);
     pieSeries.IndependentValueBinding = new Binding("Key");
     pieSeries.DependentValueBinding = new Binding("Value");
     TestAsync(
         chart,
         () => pieSeries.ItemsSource = objects,
         () => Assert.AreEqual(3, chart.LegendItems.Cast<object>().Count()),
         () => Assert.AreEqual(3, ChartTestUtilities.GetDataPointsForSeries(pieSeries).Count));
 }
Esempio n. 19
0
 public void TitleStyleChange()
 {
     Chart chart = new Chart();
     // Change ISeriesHost's Template because Silverlight only allows setting Style properties once.
     chart.Template = new ControlTemplate();
     Style style = new Style(typeof(Title));
     TestAsync(
         chart,
         () => chart.TitleStyle = style,
         () => Assert.AreSame(style, chart.TitleStyle));
 }
Esempio n. 20
0
 public void SeriesItemsSourceChange()
 {
     Chart chart = new Chart();
     DataPointSeries series = new ColumnSeries();
     TestAsync(
         chart,
         () => series.ItemsSource = new int[] { 1, 2 },
         () => chart.Series.Add(series),
         () => AssertSeriesCorrect(chart, series),
         () => series.ItemsSource = new double[] { 1.1, 2.1 },
         () => AssertSeriesCorrect(chart, series));
 }
Esempio n. 21
0
 public void SimpleChartWithBindings()
 {
     DataPointSeries series = DefaultSeriesToTest;
     series.ItemsSource = new[] { new KeyValuePair<string, double>("A", 2) };
     series.IndependentValueBinding = new Binding("Key");
     series.DependentValueBinding = new Binding("Value");
     Chart chart = new Chart();
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => Assert.AreEqual(1, chart.Series.Count),
         () => Assert.AreEqual(1, ChartTestUtilities.GetDataPointsForSeries(series).Count));
 }
Esempio n. 22
0
 /// <summary>
 /// Asserts that the content of a ISeriesHost's Series property collection is correct.
 /// </summary>
 /// <param name="chart">ISeriesHost instance to use.</param>
 /// <param name="expected">Expected collection.</param>
 private static void AssertSeriesCorrect(Chart chart, params Series[] expected)
 {
     Assert.AreEqual(expected.Length, chart.Series.Count);
     for (int i = 0; i < expected.Length; i++)
     {
         Assert.AreSame(expected[i], chart.Series[i]);
         Assert.AreSame(chart, expected[i].SeriesHost);
     }
 }
Esempio n. 23
0
 /// <summary>
 /// Create a ISeriesHost with a DateTime Axis and a TimeSpan so it can pick the appropriate interval.
 /// </summary>
 /// <param name="timeSpan">Time span for the data.</param>
 /// <returns>ISeriesHost for testing.</returns>
 private static Chart CreateDateTimeAxisWithIntervalChart(TimeSpan timeSpan)
 {
     Chart chart = new Chart();
     DateTimeAxis dateTimeAxis = new DateTimeAxis();
     dateTimeAxis.Orientation = AxisOrientation.Horizontal;
     chart.Axes.Add(dateTimeAxis);
     DataPointSeries series = new LineSeries();
     series.DependentValueBinding = new Binding("Day");
     series.IndependentValueBinding = new Binding();
     DateTime start = new DateTime(2008, 1, 1);
     series.ItemsSource = new DateTime[] { start, start + timeSpan };
     chart.Series.Add(series);
     return chart;
 }
Esempio n. 24
0
 public void ItemsSourceWithCustomObjects()
 {
     Chart chart = new Chart();
     DataPointSeries series = DefaultSeriesToTest;
     ObservableCollection<DataObject> itemsSource = new ObservableCollection<DataObject>();
     NotifyingDataObject notifyingDataObject = new NotifyingDataObject { Value = 5 };
     itemsSource.Add(notifyingDataObject);
     itemsSource.Add(new DataObject { Value = 3 });
     series.ItemsSource = itemsSource;
     series.DependentValueBinding = new Binding("Value");
     series.IndependentValueBinding = new Binding("Value");
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => notifyingDataObject.Value++,
         () => itemsSource.RemoveAt(0));
 }
Esempio n. 25
0
 public override void UseDateTimeValueAsDependentValue()
 {
     Chart chart = new Chart();
     BubbleSeries series = (BubbleSeries) DataPointSeriesWithAxesToTest;
     series.SizeValueBinding = new Binding("Day");
     DateTime[] dateTimes = new[] { DateTime.Now };
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => series.ItemsSource = dateTimes);
 }
Esempio n. 26
0
 public void SetSelectedItemValid()
 {
     Chart chart = new Chart();
     DataPointSeries series = DefaultSeriesToTest;
     series.IndependentValueBinding = new Binding();
     int[] itemsSource = new int[] { 1 };
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => series.ItemsSource = itemsSource,
         () => series.SelectedItem = 1,
         () => Assert.AreEqual(1, series.SelectedItem));
 }
 public void AutomaticSeriesTitleNotApplied()
 {
     DataPointSeries series = DefaultSeriesToTest;
     string title = "Custom Series Title";
     series.Title = title;
     Chart chart = new Chart();
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => Assert.AreSame(title, series.Title));
 }
Esempio n. 28
0
 public void SetSeriesStylesProperty()
 {
     Chart chart = new Chart();
     PieSeries series = DefaultSeriesToTest as PieSeries;
     series.IndependentValueBinding = new Binding();
     series.ItemsSource = new int[] { 4, 5, 6 };
     List<Style> styles = new List<Style>();
     styles.Add(new Style(typeof(Control)));
     styles.Add(new Style(typeof(DataPoint)));
     series.StylePalette = styles;
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => series.StylePalette.RemoveAt(0),
         () => chart.Refresh());
 }
 public void AutomaticSeriesTitleRemoved()
 {
     DataPointSeries series = DefaultSeriesToTest;
     Chart chart = new Chart();
     TestAsync(
         chart,
         () => chart.Series.Add(series),
         () => Assert.AreEqual("Series 1", series.Title),
         () => chart.Series.Remove(series),
         () => Assert.IsNull(series.Title));
 }
Esempio n. 30
0
 public void PieSeriesWithOneDoubleValueNan()
 {
     KeyValuePair<string, double>[] objects = new KeyValuePair<string, double>[]
         {
             new KeyValuePair<string, double>("A", double.NaN)
         };
     Chart chart = new Chart();
     DataPointSeries pieSeries = DefaultSeriesToTest;
     chart.Series.Add(pieSeries);
     pieSeries.IndependentValueBinding = new Binding("Key");
     pieSeries.DependentValueBinding = new Binding("Value");
     TestAsync(
         chart,
         () => pieSeries.ItemsSource = objects,
         () => Assert.AreEqual(1, chart.LegendItems.Cast<object>().Count()),
         () =>
         {
             IList<PieDataPoint> pieDataPoints = ChartTestUtilities.GetDataPointsForSeries(pieSeries).Cast<PieDataPoint>().ToList();
             Assert.AreEqual(1, pieDataPoints.Count);
             Assert.IsNull(pieDataPoints[0].Geometry);
         });
 }
Esempio n. 31
0
        /// <summary>
        /// Generates various Series samples.
        /// </summary>
        /// <param name="panel">Panel to add the generated Charts to.</param>
        /// <param name="seriesConstructor">Function that returns a Series instance for each sample.</param>
        /// <param name="scenarios">Collection of scenarios to generate.</param>
        /// <param name="chartModifier">Function that applies any necessary modifications to the Chart.</param>
        private static void GenerateSeriesSamples(Panel panel, Func<Series> seriesConstructor, IEnumerable<Scenario> scenarios, Action<Chart> chartModifier)
        {
            Style wrapperStyle = Application.Current.Resources["WrapperStyle"] as Style;

            // For each scenario...
            foreach (Scenario scenario in scenarios)
            {
                // Create the sample Chart
                Chart chart = new Chart { Title = scenario.Title, MaxWidth = 500, MaxHeight = 270 };
                foreach (IEnumerable itemsSource in scenario.ItemsSources)
                {
                    DataPointSeries series = seriesConstructor() as DataPointSeries;
                    series.ItemsSource = itemsSource;
                    series.DependentValueBinding = scenario.DependentValueBinding;
                    series.IndependentValueBinding = scenario.IndependentValueBinding;
                    chart.Series.Add(series);
                }
                if (null != chartModifier)
                {
                    chartModifier(chart);
                }

                // Wrap the Chart in a suitably formatted Grid
                Grid grid = new Grid { Style = wrapperStyle };
                grid.Children.Add(chart);
                panel.Children.Add(grid);
            }
        }
Esempio n. 32
0
 public void SimpleChartTwoIntegers()
 {
     DataPointSeries series = DefaultSeriesToTest;
     series.ItemsSource = new List<int>(new int[] { 1, -1 });
     Chart chart = new Chart();
     chart.Series.Add(series);
     TestAsync(
         chart,
         () => Assert.AreEqual(2, ChartTestUtilities.GetDataPointsForSeries(series).Count));
 }
Esempio n. 33
0
 public void SeriesInMultipleCharts()
 {
     Grid grid = new Grid();
     Chart chartA = new Chart();
     grid.Children.Add(chartA);
     Chart chartB = new Chart();
     grid.Children.Add(chartB);
     DataPointSeries series = new ColumnSeries();
     TestAsync(
         grid,
         () => chartA.Series.Add(series),
         () => chartB.Series.Add(series));
 }