コード例 #1
0
        /// <summary>
        /// Creates a new chart or adds data to an existing one.
        /// </summary>
        /// <param name="allDatasetMetricCharts">All results calculated so far.</param>
        /// <param name="dataset">The dataset name.</param>
        /// <param name="metric">The metric data.</param>
        /// <param name="technique">The technique name.</param>
        private static void StoreTechnique(SortedDictionary <string, Dictionary <string, Chart> > allDatasetMetricCharts,
                                           string dataset, Metric metric, string technique)
        {
            // Does this dataset have already been added?
            Dictionary <string, Chart> charts;
            bool newDataset = (allDatasetMetricCharts.TryGetValue(dataset, out charts) == false);

            if (newDataset)
            {
                charts = new Dictionary <string, Chart>();
            }

            // Does this dataset have already been added?
            Chart chart = null;

            charts.TryGetValue(metric.MetricName, out chart);
            if (metric is BoxSummaryData)
            {
                BoxPlot bp = null;
                if (chart is BoxPlot)
                {
                    bp = (BoxPlot)chart;
                }
                else
                {
                    bp = new BoxPlot(metric.MetricName, metric.Description);
                }

                bool boxAdded = bp.AddBox((BoxSummaryData)metric, technique);
                if (chart == null && boxAdded)
                {
                    charts.Add(metric.MetricName, bp);
                }
            }
            else if (metric is LineSeries)
            {
                LineChart lc = null;
                if (chart is LineChart)
                {
                    lc = (LineChart)chart;
                }
                else
                {
                    lc = new LineChart(metric.MetricName, metric.Description);
                }

                bool lineAdded = lc.AddLine((LineSeries)metric, technique);
                if (chart == null && lineAdded)
                {
                    charts.Add(metric.MetricName, lc);
                }
            }

            if (newDataset && charts.Count > 0)
            {
                allDatasetMetricCharts.Add(dataset, charts);
            }
        }
コード例 #2
0
 public BoxPlot[] BoxPlot(double k = 1.5)
 {
     BoxPlot[] boxPlots = new BoxPlot[Count];
     for (int i = 0; i < Count; i++)
     {
         boxPlots[i] = this[i].BoxPlot(k);
     }
     return(boxPlots);
 }
コード例 #3
0
        public override void WriteJson(JsonWriter writer,
                                       object untypedValue,
                                       JsonSerializer serializer)
        {
            if (untypedValue == null)
            {
                serializer.Serialize(writer,
                                     null);

                return;
            }

            BoxPlot value = (BoxPlot)untypedValue;

            switch (value)
            {
            case BoxPlot.Area:
                serializer.Serialize(writer,
                                     "area");

                return;

            case BoxPlot.Bar:
                serializer.Serialize(writer,
                                     "bar");

                return;

            case BoxPlot.Boxplot:
                serializer.Serialize(writer,
                                     "boxplot");

                return;

            case BoxPlot.Circle:
                serializer.Serialize(writer,
                                     "circle");

                return;

            case BoxPlot.Errorband:
                serializer.Serialize(writer,
                                     "errorband");

                return;

            case BoxPlot.Errorbar:
                serializer.Serialize(writer,
                                     "errorbar");

                return;

            case BoxPlot.Geoshape:
                serializer.Serialize(writer,
                                     "geoshape");

                return;

            case BoxPlot.Image:
                serializer.Serialize(writer,
                                     "image");

                return;

            case BoxPlot.Line:
                serializer.Serialize(writer,
                                     "line");

                return;

            case BoxPlot.Point:
                serializer.Serialize(writer,
                                     "point");

                return;

            case BoxPlot.Rect:
                serializer.Serialize(writer,
                                     "rect");

                return;

            case BoxPlot.Rule:
                serializer.Serialize(writer,
                                     "rule");

                return;

            case BoxPlot.Square:
                serializer.Serialize(writer,
                                     "square");

                return;

            case BoxPlot.Text:
                serializer.Serialize(writer,
                                     "text");

                return;

            case BoxPlot.Tick:
                serializer.Serialize(writer,
                                     "tick");

                return;

            case BoxPlot.Trail:
                serializer.Serialize(writer,
                                     "trail");

                return;
            }

            throw new Exception("Cannot marshal type BoxPlot");
        }