Ejemplo n.º 1
0
        /// <summary>
        /// GetDataDisplayColumnsFormValue
        /// </summary>
        /// <param name="rules"></param>
        /// <returns></returns>

        List <ColorCodingItemMsx> GetColorCodingColumnsFormValues(
            TrellisCardBarChartControl cc)
        {
            CondFormatRules           rules = cc.GetCondFormatRulesFromDataTable();
            List <ColorCodingItemMsx> ccl   = ConvertCondFormatRulesToColorCodingItems(rules);

            return(ccl);
        }
Ejemplo n.º 2
0
        void SetupCondFormatRulesFromColorCodingItems(
            TrellisCardBarChartControl cc,
            List <ColorCodingItemMsx> ccl,
            CondFormatStyle cfStyle)
        {
            CondFormatRules rules = new CondFormatRules(cfStyle);

            foreach (ColorCodingItemMsx i in ccl)
            {
                CondFormatRule r = new CondFormatRule();
                r.Name = i.ColumnName;
                string suffix = "";

                if (cfStyle == CondFormatStyle.ColorSet)
                {
                    r.BackColor1 = i.BackColor;
                }

                else                 // Gradient
                {
                    int ruleCnt = i.SubRules.Count;

                    List <string> subruleText = new List <string>();
                    foreach (ColorCodingSubRuleMsx ccr in i.SubRules)
                    {
                        string txt = ccr.Value;
                        if (ccr.CalcType != ValueCalcTypeEnumMsx.Value)
                        {
                            txt += " (" + ccr.CalcType + ")";
                        }
                        subruleText.Add(txt);
                    }

                    List <Color> colors = new List <Color>();
                    if (ruleCnt > 0)
                    {
                        r.Value = subruleText[0];
                        colors.Add(i.SubRules[0].Color);
                    }

                    if (ruleCnt > 2)
                    {
                        r.Value2 = subruleText[2];                        // max rule text
                        colors.Add(i.SubRules[1].Color);                  // avg color
                        colors.Add(i.SubRules[2].Color);                  // max color
                    }

                    else if (ruleCnt > 1)
                    {
                        r.Value2 = subruleText[1];
                        colors.Add(i.SubRules[1].Color);
                    }

                    string scaleName = Bitmaps.GetColorScaleNameFromColorset(colors.ToArray());
                    if (Lex.IsUndefined(scaleName))
                    {
                        scaleName = CondFormat.DefaultColorScale;
                    }
                    r.ImageName = scaleName;
                }

                rules.Add(r);
            }

            cc.Setup(SVP, rules, EditValueChanged);
            return;
        }