private static void OnIndependentAxisPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            StackedColumnSeries source = (StackedColumnSeries)d;
            IAxis newValue             = (IAxis)e.NewValue;

            source.OnIndependentAxisPropertyChanged(newValue);
        }
 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")));
 }
Beispiel #3
0
        private void client_GetFacilityCumulAvgCostofARVandOIPerPatientPerMonthCompleted(object sender, GetFacilityCumulAvgCostofARVandOIPerPatientPerMonthCompletedEventArgs e)
        {
            XDocument xmlDoc = XDocument.Parse(e.Result.Nodes[1].ToString());

            var enumerable = from item in xmlDoc.Descendants("Table")
                             select new SchemeResult()
            {
                Name  = item.Element("MonthYear").Value,
                Value = Convert.ToDecimal(item.Element("TotalAvgCostForARV").Value)
            };

            var enumerable1 = from item in xmlDoc.Descendants("Table")
                              select new SchemeResult()
            {
                Name  = item.Element("MonthYear").Value,
                Value = Convert.ToDecimal(item.Element("TotalAvgCostForOI").Value)
            };

            StackedColumnSeries Cumseries1 = (StackedColumnSeries)mcChartCumARVandOI.Series[0];

            Cumseries1.Title       = "ARVs";
            Cumseries1.ItemsSource = enumerable;


            StackedColumnSeries Cumseries2 = (StackedColumnSeries)mcChartCumARVandOI.Series[1];

            Cumseries2.Title       = "OIs";
            Cumseries2.ItemsSource = enumerable1;

            if (Enumerable.ToList <SchemeResult>(enumerable).Count > 0)
            {
                this.DownloadCumARVandOILink.Visibility = Visibility.Visible;
            }
            else
            {
                this.DownloadCumARVandOILink.Visibility = Visibility.Collapsed;
            }
            this.LoadFacilityTotalCostLostToFollowup(transactionStartDate, transactionEndDate);
        }
        protected override void UpdateDataPoint(DataPoint dataPoint)
        {
            if (SeriesHost == null || PlotArea == null)
            {
                return;
            }

            object            category        = dataPoint.IndependentValue ?? (this.ActiveDataPoints.IndexOf(dataPoint) + 1);
            Range <UnitValue> coordinateRange = GetCategoryRange(category);

            if (!coordinateRange.HasData)
            {
                return;
            }
            else if (coordinateRange.Maximum.Unit != Unit.Pixels || coordinateRange.Minimum.Unit != Unit.Pixels)
            {
                throw new InvalidOperationException("This Series Does Not Support Radial Axes");
            }

            double minimum = (double)coordinateRange.Minimum.Value;
            double maximum = (double)coordinateRange.Maximum.Value;

            double plotAreaHeight = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Range.Maximum).Value.Value;
            IEnumerable <StackedColumnSeries> columnSeries = SeriesHost.Series.OfType <StackedColumnSeries>().Where(series => series.ActualIndependentAxis == ActualIndependentAxis);
            int    numberOfSeries       = columnSeries.Count();
            double coordinateRangeWidth = (maximum - minimum);
            double segmentWidth         = coordinateRangeWidth * 0.8;

            double columnWidth = segmentWidth; // / numberOfSeries;
            int    seriesIndex = columnSeries.IndexOf(this);

            double dataPointY = ActualDependentRangeAxis.GetPlotAreaCoordinate(ValueHelper.ToDouble(dataPoint.ActualDependentValue)).Value.Value;
            double zeroPointY = ActualDependentRangeAxis.GetPlotAreaCoordinate(ActualDependentRangeAxis.Origin).Value.Value;

            // Need to shift the columns up to take account of the other columns that are already rendered, to make them
            // appear stacked
            int dataPointIndex = ActiveDataPoints.IndexOf(dataPoint);

            for (int i = numberOfSeries - 1; i > seriesIndex; i--)
            {
                StackedColumnSeries prevSeries = columnSeries.ElementAt <StackedColumnSeries>(i);

                if (prevSeries.ActiveDataPointCount >= dataPointIndex + 1)
                {
                    DataPoint currDataPoint = prevSeries.ActiveDataPoints.ElementAt <DataPoint>(dataPointIndex);

                    // Need to move positive columns up and negative ones down
                    if ((double)dataPoint.ActualDependentValue > 0 && (double)currDataPoint.ActualDependentValue > 0)
                    {
                        dataPointY += currDataPoint.Height;
                        zeroPointY += currDataPoint.Height;
                    }
                    else if ((double)dataPoint.ActualDependentValue < 0 && (double)currDataPoint.ActualDependentValue < 0)
                    {
                        dataPointY -= currDataPoint.Height;
                        zeroPointY -= currDataPoint.Height;
                    }
                }
            }

            double offset     = 0;
            double dataPointX = minimum + offset;

            if (GetIsDataPointGrouped(category))
            {
                IGrouping <object, DataPoint> categoryGrouping = GetDataPointGroup(category);
                int index = categoryGrouping.IndexOf(dataPoint);
                dataPointX  += (index * (columnWidth * 0.2)) / (categoryGrouping.Count() - 1);
                columnWidth *= 0.8;
                Canvas.SetZIndex(dataPoint, -index);
            }

            if (ValueHelper.CanGraph(dataPointY) && ValueHelper.CanGraph(dataPointX) && ValueHelper.CanGraph(zeroPointY))
            {
                double left  = Math.Round(dataPointX);
                double width = Math.Round(columnWidth);

                double top    = Math.Round(plotAreaHeight - Math.Max(dataPointY, zeroPointY) + 0.5);
                double bottom = Math.Round(plotAreaHeight - Math.Min(dataPointY, zeroPointY) + 0.5);
                double height = bottom - top + 1;

                Canvas.SetLeft(dataPoint, left);
                Canvas.SetTop(dataPoint, top);
                dataPoint.Width  = width;
                dataPoint.Height = height;
            }
        }