Example #1
0
		public PieWindow(DateTime odDatum, DateTime doDatum) : base(Gtk.WindowType.Toplevel)
		{
			this.Build();
			this.Icon = this.RenderIcon("Icon", IconSize.Menu, null);
			this.Title = "Grafikon pita";

			this.SetSizeRequest(800, 600);
			var pv = new PlotView();
			var myModel = new PlotModel { Title = "Statistika: " + odDatum.ToShortDateString() + " - " + doDatum.ToShortDateString() };
			var series = new PieSeries
			{ StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 };

			foreach (KeyValuePair<string, double> s in Baza.getInstance.getSumiraneTroskoveURazdoblju(odDatum,doDatum))
			{
				series.Slices.Add(new PieSlice(s.Key, s.Value));

			}
			myModel.Series.Add(series);
			pv.Model = myModel;
			var v = new VBox();
			v.Add(pv);
			var save = new Button(ImageButton.imageButton("gtk-save"));
			save.Clicked += (sender, e) =>
			{
				PlotSaver.saveToFile(this, "PieChart_" + odDatum.ToShortDateString() + "_-_" + doDatum.ToShortDateString() + ".png", myModel);
			};

			v.PackEnd(save, false, false, 10);
			this.Add(v);
			this.ShowAll();

		}
Example #2
0
        public void plotSveKategorije(DateTime odDatum, DateTime doDatum)
        {
            this.SetSizeRequest(800, 500);
            var pv = new PlotView();

            var myModel = new PlotModel {
                Title = "Statistika", LegendTitle = "Legenda"
            };
            var x = new DateTimeAxis()
            {
                Title = "Datum", TitleColor = OxyColors.DarkGreen
            };
            var y = new LinearAxis()
            {
                Position = AxisPosition.Left, Minimum = 0, LabelFormatter = StringManipulator.formatter, Title = "Troskovi"
            };

            myModel.Axes.Add(x);
            myModel.Axes.Add(y);

            var lista = Baza.getInstance.getKategorije();

            foreach (string s in lista)
            {
                var l = new LineSeries()
                {
                    Title = s
                };
                var list = Baza.getInstance.getGrupiraneTroskoveURazdoblju(odDatum, doDatum, s);
                if (list.Count > 0)
                {
                    foreach (Trosak t in list)
                    {
                        DateTime datum;
                        datum = DateTime.ParseExact(t.Datum, "dd-MM-yyyy", null);

                        l.Points.Add(new DataPoint(DateTimeAxis.ToDouble(datum), t.Cijena));
                    }

                    myModel.Series.Add(l);
                }
            }


            pv.Model = myModel;
            var v = new VBox();

            v.Add(pv);
            var save = new Button(ImageButton.imageButton("gtk-save"));

            save.Clicked += (sender, e) =>
            {
                PlotSaver.saveToFile(this, "LineChart_" + odDatum.ToShortDateString() + "_-_" + doDatum.ToShortDateString() + ".png", myModel);
            };

            v.PackStart(save, false, false, 10);
            this.Add(v);
            this.ShowAll();
        }
Example #3
0
        private VBox dodajOstalo(PlotModel myModel, DateTime odDatum, DateTime doDatum, string ime)
        {
            var pv = new PlotView();

            pv.Model = myModel;
            var v = new VBox();

            v.Add(pv);
            var save = new Button(ImageButton.imageButton("gtk-save"));

            save.Clicked += (sender, e) =>
            {
                PlotSaver.saveToFile(ime + "_" + odDatum.ToString("dd.MM.yyyy") + "_-_" + doDatum.ToString("dd.MM.yyyy") + ".png", myModel);
                MessageBox.Show(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Grafikon spremljen na radnu površinu");
            };

            v.PackEnd(save, false, false, 10);
            return(v);
        }
Example #4
0
        public VBox Kategorije(Callback c)
        {
            var kategorijeBox = new VBox(false, 10);
            var lista         = Kategorija.kategorije;

            foreach (var s in lista)
            {
                string icon   = s.Naziv;
                var    lookup = Stetic.Gui.w1.Lookup(icon);
                if (lookup == null)
                {
                    icon = "r";
                }

                var b = ImageButton.imageButton(icon, s.Naziv);

                b.HeightRequest = 50;
                b.WidthRequest  = 200;

                kategorijeBox.PackStart(b, false, false, 0);
                c.Invoke(b);
            }
            return(kategorijeBox);
        }
Example #5
0
        public void barPlot(DateTime odDatum, DateTime doDatum)
        {
            var items = new List <ColumnItem>();
            var kat   = new List <string>();
            var list  = Baza.getInstance.getSumiraneTroskoveURazdoblju(odDatum, doDatum);

            foreach (KeyValuePair <string, double> t in list)
            {
                var b = new ColumnItem(t.Value);
                items.Add(b);
                kat.Add(t.Key);
            }

            if (list.Count > 1)
            {
                int i         = 0;
                var listaBoja = OxyPalettes.Cool(list.Count).Colors;
                foreach (ColumnItem cI in items)
                {
                    cI.Color = listaBoja[i];
                    i++;
                }
            }


            var barSeries = new ColumnSeries()
            {
                ItemsSource       = items,
                LabelPlacement    = LabelPlacement.Base,
                LabelFormatString = "{0:.00} kn"
            };



            var model = new PlotModel {
                Title = "Statistika za razdoblje: " + odDatum.ToShortDateString() + " - " + doDatum.ToShortDateString()
            };

            this.SetSizeRequest(800, 600);
            var pv = new PlotView();

            model.Series.Add(barSeries);



            model.Axes.Add(new CategoryAxis
            {
                Position    = AxisPosition.Bottom,
                Key         = "Datum",
                ItemsSource = kat
            });

            model.Axes.Add(new LinearAxis
            {
                Position       = AxisPosition.Left,
                Minimum        = 0,
                LabelFormatter = StringManipulator.formatter
            });

            pv.Model = model;
            var v = new VBox();

            v.Add(pv);
            var save = new Button(ImageButton.imageButton("gtk-save"));

            save.Clicked += (sender, e) =>
            {
                PlotSaver.saveToFile(this, "BarChart_" + odDatum.ToShortDateString() + "_-_" + doDatum.ToShortDateString() + ".png", model);
            };

            v.PackStart(save, false, false, 10);
            this.Add(v);
            this.ShowAll();
        }