public RVFormattingSpec GetFormattingSettingsForField(string fieldName, RVDashboardDataType dataType, RVFormattingSpec currentSettings, bool isAggregated)
            {
                if (dataType == RVDashboardDataType.Date && isAggregated == false)
                {
                    var newSettings = new RVDateFormattingSpec()
                    {
                        DateFormat = "YYYY年MM月dd日"
                    };

                    return(newSettings);
                }
                else if (dataType == RVDashboardDataType.Number)
                {
                    if (currentSettings != null && (currentSettings as RVNumberFormattingSpec).FormatType == RVDashboardNumberFormattingType.Currency)
                    {
                        var numberFormatting = new RVNumberFormattingSpec();
                        switch ((currentSettings as RVNumberFormattingSpec).FormatType)
                        {
                        case RVDashboardNumberFormattingType.Currency:
                            numberFormatting.ApplyMkFormat         = false;
                            numberFormatting.ShowGroupingSeparator = true;
                            numberFormatting.DecimalDigits         = 0;
                            numberFormatting.CurrencySymbol        = "¥";
                            numberFormatting.FormatType            = RVDashboardNumberFormattingType.Currency;
                            return(numberFormatting);

                        case RVDashboardNumberFormattingType.Number:
                            break;

                        case RVDashboardNumberFormattingType.Percent:
                            break;

                        default:
                            break;
                        }
                    }
                }

                return(currentSettings);
            }
Exemplo n.º 2
0
            //public override string FormatAggregatedDate(DateTime value, RVDashboardDataType type, RVDashboardDateAggregationType aggregation, RVDateFormattingSpec formatting)
            //{
            //    return base.FormatAggregatedDate(value, type, aggregation, formatting);
            //}

            public override string FormatAggregatedDate(DateTime value, RVDashboardDataType type, RVDashboardDateAggregationType aggregation, RVDateFormattingSpec formatting)
            {
                if (aggregation == RVDashboardDateAggregationType.Year)
                {
                    return(string.Format("{0:yyyy年}", value));
                }
                if (aggregation == RVDashboardDateAggregationType.Month)
                {
                    return(string.Format("{0:yyyy年MM月}", value));
                }
                if (aggregation == RVDashboardDateAggregationType.Day)
                {
                    return(string.Format("{0:yyyy年MM月dd日}", value));
                }

                return(base.FormatAggregatedDate(value, type, aggregation, formatting));
            }