Пример #1
0
        public PlotModel CreatePlotModel()
        {
            var model = new PlotModel
            {
                Title                 = "Top 5 Neighborhood",
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };
            IFactory factory      = new ConcreteFactory();
            var      s1           = factory.CreateColumnSeriesBasic("Bike Storage Unit");
            var      categoryAxis = factory.CreateCategoryAxisBasic("Neighborhoods");
            var      valueAxis    = factory.CreateLinearAxisBasic("Total Amount");

            Dictionary <string, int> fs = preLoad.csvFT.getBarchart();

            foreach (KeyValuePair <string, int> item in fs)
            {
                s1.Items.Add(new ColumnItem {
                    Value = item.Value
                });
                categoryAxis.Labels.Add(item.Key);
            }

            model.Series.Add(s1);
            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);

            return(model);
        }
Пример #2
0
        public PlotModel CreatePlotModel()
        {
            var model = new PlotModel
            {
                Title                 = "Grouped chart of " + deelgem,
                LegendPlacement       = LegendPlacement.Outside,
                LegendPosition        = LegendPosition.BottomCenter,
                LegendOrientation     = LegendOrientation.Horizontal,
                LegendBorderThickness = 0
            };

            IFactory factory      = new ConcreteFactory();
            var      s1           = factory.CreateColumnSeriesBasic("Bike Thefts");
            var      s2           = factory.CreateColumnSeriesBasic("Bike Storage Units");
            var      categoryAxis = factory.CreateCategoryAxisMonths();
            var      valueAxis    = factory.CreateLinearAxisBasic("Total amount");

            Dictionary <int, int> fs = preLoad.csvFD.getBarchartGroupFD(buurt);

            foreach (KeyValuePair <int, int> item in fs)
            {
                s1.Items.Add(new ColumnItem {
                    Value = item.Value
                });
            }

            if (this.deelgem != null)
            {
                Dictionary <int, int> fs2 = preLoad.csvFT.getBarchartGroupFT(deelgem);
                foreach (KeyValuePair <int, int> item in fs2)
                {
                    s2.Items.Add(new ColumnItem {
                        Value = item.Value
                    });
                }
                model.Series.Add(s2);
            }


            model.Series.Add(s1);

            model.Axes.Add(categoryAxis);
            model.Axes.Add(valueAxis);

            return(model);
        }