private void InitializeSeries()
        {
            viewModel = new ViewModels.BudgetManagement.BudgetProjectMonthReportViewModel();

            var x = new DataMapping() { MemberName = "AxisXLabel", Path = "Name" };
            var y = new DataMapping() { MemberName = "YValue", Path = "TotalAmout" };

            //IncomeSeries = new DataSeries();
            BudgetSerise.LegendText = AppResources.BudgetManagement;

            //ExpenseSeries = new DataSeries();
            SettleSeries.LegendText = AppResources.SettleExpense;

            this.BudgetSerise.DataMappings = new DataMappingCollection() { y, y };
            this.SettleSeries.DataMappings = new DataMappingCollection() { x, y };

            this.BudgetSettleChart.DataContext = viewModel;

        }
        public CategorySummary()
        {
            InitializeComponent();
            NeedRefreshData = false;
            var currencySymbol = AppSetting.Instance.DefaultCurrency.GetCurrencyStringWithNameFirst();
            chartTitleForCount = LocalizedStrings.GetLanguageInfoByKey("{0}({1})", new string[] { "CategoryTitleForCount", "ItemUnit" });
            chartTitleForAmount = "{0}({1})".FormatWith(LocalizedStrings.GetLanguageInfoByKey("CategoryTitleForAmount"), currencySymbol);

            DataMapping dm_Name = new DataMapping() { MemberName = "AxisXLabel", Path = "Name" };
            DataMapping dm_Count = new DataMapping() { MemberName = "YValue", Path = DependentValuePathForCount };
            DataMapping dm_TotalAmount = new DataMapping() { MemberName = "YValue", Path = DependentValuePathForAmount };
            MappingForCount = new DataMappingCollection() { dm_Name, dm_Count };
            MappingForTotalAmount = new DataMappingCollection() { dm_Name, dm_TotalAmount };

            this.PieChart.Series[0].DataMappings = MappingForCount;

            this.PieChart.Series[0].LabelText = "#AxisXLabel, {0}#YValue".FormatWith(AppSetting.Instance.DefaultCurrency.GetCurrentString());

            ChartTitle = new Title() { Text = string.Empty };
            summaryTitle = new Title() { Text = string.Empty };
            this.PieChart.Titles.Add(summaryTitle);
            this.PieChart.Titles.Add(ChartTitle);
            SetChartTitle(DependentValuePathForCount);
        }
예제 #3
0
        /// <summary>
        /// Reset value of the property that was mapped
        /// </summary>
        /// <param name="dm">DataMapping</param>
        /// <param name="dataSource">DataSource</param>
        internal void ResetBindProperty(DataMapping dm, Object dataSource)
        {   
            Double[] newYValues = new Double[4];

            if (YValues != null)
                YValues.CopyTo(newYValues, 0);

            switch (dm.MemberName)
            {   
                case "Open":
                case "Close":
                case "High":
                case "Low":

                    if (YValues == null)
                    {   
                        Int32 enumIndex = (Int32)Enum.Parse(typeof(OCHL), dm.MemberName, true);
                        YValues[enumIndex] = 0;
                    }

                    break;

                default:
                    this.GetType().GetProperty(dm.MemberName).SetValue(this, null, null);
                    break;
            }
        }
예제 #4
0
        /// <summary>
        /// Update value of the property from DataSource
        /// </summary>
        /// <param name="dm">DataMapping</param>
        /// <param name="dataSource">DataSource</param>
        internal void UpdateBindProperty(DataMapping dm, Object dataSource)
        {   
            switch (dm.MemberName)
            {
                case "Open":
                case "Close":
                case "High":
                case "Low":

                    Double[] newYValues = new Double[4];
                    if (YValues != null)
                        YValues.CopyTo(newYValues, 0);

                    // find the array index of OCHL (open close high low)
                    Int32 enumIndex = (Int32)Enum.Parse(typeof(OCHL), dm.MemberName, true);

                    newYValues[enumIndex] = (Double)dm.GetPropertyValue(dataSource);
                    YValues = newYValues;
                    break;

                default:

                    dm.Map(dataSource, this);
                    break;
            }
        }