Ejemplo n.º 1
0
        public static (string[] series, string[] seriesLNA) GenerateSeries(List <ReportEntry> reports, Noise noise, Style style)
        {
            if (!style.chartOutput)
            {
                return(null, null);
            }

            string[] seriesLNA = new string[reports.Count];   // can contain nulls if series are duplicates
            paletteNo = (reports.Count - 1) % palette.Length; // because we scan palette backwards
            for (int i = reports.Count - 1; i >= 0; i--)      // add series backwards so that Red is in front
            // generate LNA-dependent series
            {
                ReportEntry entry          = reports[i];
                bool        noisePlottable = (noise != Noise.None) && entry.flow.HasStochasticVariance() && !entry.flow.HasNullVariance();
                if (noisePlottable)
                {
                    string reportName = (entry.asLabel != null) ? entry.asLabel : entry.flow.TopFormat(style.RestyleAsNumberFormat("G4"));
                    string seriesName = reportName + Gui.StringOfNoise(noise);
                    seriesLNA[i] = KChartHandler.ChartAddSeries(seriesName, entry.flow, palette[paletteNo % palette.Length], noise); // could be null
                }
                paletteNo--; if (paletteNo < 0)
                {
                    paletteNo += palette.Length;                             // decrement out here to keep colors coordinated
                }
            }

            string[] series = new string[reports.Count];      // can contain nulls if series are duplicates
            paletteNo = (reports.Count - 1) % palette.Length; // because we scan palette backwards
            for (int i = reports.Count - 1; i >= 0; i--)      // add series backwards so that Red is in front
            // generate deterministic series
            {
                ReportEntry entry          = reports[i];
                bool        meanPlottable  = (noise == Noise.None && entry.flow.HasDeterministicValue()) || ((noise != Noise.None) && entry.flow.HasStochasticMean());
                bool        noisePlottable = (noise != Noise.None) && entry.flow.HasStochasticVariance() && !entry.flow.HasNullVariance();
                if (meanPlottable)
                {
                    string reportName = (entry.asLabel != null) ? entry.asLabel : entry.flow.TopFormat(style.RestyleAsNumberFormat("G4"));
                    string seriesName = reportName + (noisePlottable ? Gui.StringOfNoise(Noise.None) : "");                            // do postfix mu if there is no sigma plot for it
                    //string seriesName = reportName + ((noise == Noise.None) ? "" : Gui.StringOfNoise(Noise.None)); // previous version
                    series[i] = KChartHandler.ChartAddSeries(seriesName, entry.flow, palette[paletteNo % palette.Length], Noise.None); // could be null
                }
                paletteNo--; if (paletteNo < 0)
                {
                    paletteNo += palette.Length;                             // decrement out here to keep colors coordinated
                }
            }

            return(series, seriesLNA);
        }