Exemplo n.º 1
0
        public List <Plot> RenderPlots(List <Row> rows, ScatterPlotLayout layout)
        {
            var xAxisMap = layout.XAxisColumn != null
                ? _factory.CreateAxisMap(layout.XAxisColumn, 0d, 1d, layout.XAxisSortOrder)
                : null;

            var yAxisMap = layout.YAxisColumn != null
                ? _factory.CreateAxisMap(layout.YAxisColumn, 0d, 1d, layout.YAxisSortOrder)
                : null;

            var colorMap = layout.ColorColumn != null
                ? _factory.CreateColorMap(layout.ColorColumn, layout.ColorPalette, layout.ColorSortOrder)
                : null;

            var sizeMap = layout.SizeColumn != null
                ? _factory.CreateSizeMap(layout.SizeColumn, layout.LowerSize, layout.UpperSize, layout.SizeSortOrder)
                : null;

            var labelMap = layout.LabelColumn != null
                ? _factory.CreateLabelMap(layout.LabelColumn)
                : null;

            var plots = new List <Plot>();

            foreach (var row in rows)
            {
                var plot = new Plot();

                plot.Id = row.Id;

                plot.X = layout.XAxisColumn != null
                    ? xAxisMap.Map(row[layout.XAxisColumn.Index]) ?? 0.0
                    : 0.0;

                plot.Y = layout.YAxisColumn != null
                    ? yAxisMap.Map(row[layout.YAxisColumn.Index]) ?? 0.0
                    : 0.0;

                plot.Color = layout.ColorColumn != null
                    ? colorMap.Map(row[layout.ColorColumn.Index])
                    : DefaultColor;

                plot.Size = layout.SizeColumn != null
                    ? sizeMap.Map(row[layout.SizeColumn.Index]) ?? 0.0
                    : layout.UpperSize;

                plot.Image = layout.ShapeColumn != null
                    ? (BitmapImage)row[layout.ShapeColumn.Index]
                    : null;

                plot.Label = layout.LabelColumn != null
                    ? labelMap.Map(row[layout.LabelColumn.Index])
                    : null;

                plots.Add(plot);
            }

            return(plots);
        }
Exemplo n.º 2
0
        public ScatterPlot Create()
        {
            var palette = _colorPaletteFactory.GetColorPalette("Pastel 1");

            var layout = new ScatterPlotLayout()
            {
                ColorPalette = palette
            };

            var extent = new Rect(-0.1, -0.1, 1.2, 1.2);

            var plots = new List <Plot>();

            return(new ScatterPlot(layout, extent, plots));
        }
Exemplo n.º 3
0
 public ScatterPlot(ScatterPlotLayout layout, Rect viewExtent, List <Plot> plots)
 {
     _viewExtent = viewExtent;
     _plots      = plots;
     _layout     = layout;
 }
Exemplo n.º 4
0
 public ScatterPlot()
 {
     _viewExtent = new Rect(-0.1, -0.1, 1.2, 1.2);
     _plots      = new List <Plot>();
     _layout     = new ScatterPlotLayout();
 }