Exemple #1
0
        public void UpdateGraphVm()
        {
            if (Values == null)
            {
                return;
            }

            var bins = A2dUt.ToP2V(Histos.Histogram2d(
                                       bounds: Bounds,
                                       binCount: BinCounts.Sz2Int,
                                       vals: Values)).ToArray();

            var counts   = bins.Select(b => b.V.V).ToArray();
            var colorLeg = ColorLegger(counts);

            LegendVm = new LegendVm(
                minVal: "<" + colorLeg.minV,
                midVal: ColorSets.GetLegMidVal(colorLeg).ToString(),
                maxVal: ">" + colorLeg.maxV,
                minCol: colorLeg.minC,
                midColors: colorLeg.spanC,
                maxColor: colorLeg.maxC
                );

            GraphVm.Watermark = $"Bins count: [{BinCounts.X}, {BinCounts.Y}]";
            GraphVm.SetData(
                boundingRect: Bounds,
                plotPoints: Enumerable.Empty <P2V <float, Color> >(),
                plotLines: Enumerable.Empty <LS2V <float, Color> >(),
                filledRects: MakePlotRectangles(colorLeg: colorLeg, hist: bins),
                openRects: Enumerable.Empty <RV <float, Color> >());
        }
Exemple #2
0
 public Grid4DVm(P2 <int> strides, P2 <int> cursor, ColorLeg <T> colorLeg, string title = "")
 {
     X1Y1      = true;
     Strides   = strides;
     Cursor    = cursor;
     Values    = new List <LS2V <int, T> >();
     ColorLeg  = colorLeg;
     WbImageVm = new WbImageVm();
     Title     = title;
     LegendVm  = new LegendVm(
         minVal: "<" + colorLeg.minV,
         midVal: ColorSets.GetLegMidVal(colorLeg).ToString(),
         maxVal: ">" + colorLeg.maxV,
         minCol: colorLeg.minC,
         midColors: colorLeg.spanC,
         maxColor: colorLeg.maxC
         );
 }