/// <summary>
        /// Handles FormatLabel of the CategoryYAxis of this.crtCategory.
        /// </summary>
        string categoryChartChartCategoryY_FormatLabel(AxisLabelInfo info)
        {
            // This chart is bound to a BindingList of MonthlyData objects. These don't have
            // names, and even if they did, the names wouldn't be relative to the current month.
            // So here we will determine which Monthlydata is being displayed and give it
            // a user-friendly label.
            var monthlyData = (MonthlyData)info.Item;

            // If the monthlyData is null, then this is either the previous month or previous
            // year. We cannot tell which. So just display a generic message of 'no previous data'.
            if (null == monthlyData)
            {
                return(Utilities.LocalizeString("CashflowDetails_Category_Label_noPreviousData"));
            }

            if (monthlyData == this.currentMonthData)
            {
                return(Utilities.LocalizeString("CashflowDetails_Category_Label_current"));
            }
            else if (monthlyData == this.lastMonthData)
            {
                return(Utilities.LocalizeString("CashflowDetails_Category_Label_lastmonth"));
            }
            else if (monthlyData == this.lastYearData)
            {
                return(Utilities.LocalizeString("CashflowDetails_Category_Label_lastyear"));
            }

            Debug.Fail("Unknown data item");
            return(info.Value.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles FormatLabel of the NumericYAxis of this.crtMonthlyTotals.
        /// </summary>
        string monthlyTotalsChartNumericY_FormatLabel(AxisLabelInfo info)
        {
            // The decimal value has a whole lot of zeroes, so format it to the nearest
            // million.
            decimal value = (decimal)info.Value;

            return(Utilities.GetDisplayValueInMillions(value, 0, CashflowDetails.MillionsSuffix));
        }
        /// <summary>
        /// Handles FormatLabel of the CategoryXAxis of this.crtOverview.
        /// </summary>
        string overviewChartCategoryX_FormatLabel(AxisLabelInfo info)
        {
            // Instead of an integer for the month, display a user-friendly 3-letter
            // abbreviation.
            var      monthlyData = (MonthlyData)info.Item;
            DateTime dateTime    = new DateTime(monthlyData.Year, monthlyData.Month, 1);
            string   monthName   = dateTime.ToString(Utilities.LocalizeString("Chart_XAxis_Month_Format")).ToLower();

            return(monthName);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handles FormatLabel of the CategoryXAxis of this.crtLabels.
        /// </summary>
        string labelsChartCategoryX_FormatLabel(AxisLabelInfo info)
        {
            // Calculate the net (inflow - outflow) value for the month.
            var monthlyData = (MonthlyData)info.Item;
            var net         = monthlyData.Inflow - monthlyData.Outflow;

            // Format it to the nearest tenth of a million.
            var text = Utilities.GetDisplayValueInMillions(net, 1);

            return(text);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handles FormatLabel of the CategoryXAxis1 of this.crtMonthlyTotals.
        /// </summary>
        string monthlyTotalsChartCategoryX1_FormatLabel(AxisLabelInfo info)
        {
            // By default, these labels would show the Month field, which is an integer.
            // But we can do better.

            // Get the Month and Year.
            var      monthlyData = (MonthlyData)info.Item;
            DateTime dateTime    = new DateTime(monthlyData.Year, monthlyData.Month, 1);

            // For January, append the year. Since the chart is showing 13 months, at least one instance of
            // January will always be displayed, so the user will always have the year as context.
            if (dateTime.Month == 1)
            {
                return(dateTime.ToString(Utilities.LocalizeString("Chart_XAxis_Month_Format_January")).ToLower());
            }
            else
            {
                return(dateTime.ToString(Utilities.LocalizeString("Chart_XAxis_Month_Format")).ToLower());
            }
        }
 private string XAxis_FormatLabel(AxisLabelInfo info)
 {
     // throw new NotImplementedException();
     return(string.Format("{0:dd/MM}", info.DateValue));
 }
 /// <summary>
 /// Handles FormatLabel of the NumericXAxis of this.crtOverview.
 /// </summary>
 string overviewChartNumericY_FormatLabel(AxisLabelInfo info)
 {
     // Format the value in millions.
     return(Utilities.GetDisplayValueInMillions((decimal)info.Value, 1, CashflowDetails.MillionsSuffix));
 }