示例#1
2
文件: Pom.aspx.cs 项目: ddksaku/canon
        protected void Page_Load(object sender, EventArgs e)
        {
            WebChartControl chart = new WebChartControl();
            chart.EnableViewState = false;
            ChartTitle title = new ChartTitle();
            title.Text = string.Format(Utilities.GetResourceString("Common", "ChartHeader"),
                                       "Jmeno", "Start 10.12.2010","Finish 17.12.2010");
            title.Font = new System.Drawing.Font("Tahoma", 10);
            chart.Titles.Add(title);
            chart.FillStyle.FillMode = FillMode.Solid;

            Dictionary<int, Series> series = new Dictionary<int, Series>();

            Series s0 = new Series("Recommended price", ViewType.StackedBar);
            s0.ValueScaleType = ScaleType.Numerical;
            s0.ArgumentScaleType = ScaleType.DateTime;
            series.Add(0, s0);

            SetGraphPoint(series[0], "rnd");

            Series s1 = new Series("Actual price", ViewType.Line);
            s1.ValueScaleType = ScaleType.Numerical;
            s1.ArgumentScaleType = ScaleType.DateTime;
            series.Add(1, s1);

            SetGraphPoint(series[1], "fib");

            //Series s2 = new Series("Predicted price", ViewType.Bubble);
            //s2.ValueScaleType = ScaleType.Numerical;
            //s2.ArgumentScaleType = ScaleType.DateTime;
            //series.Add(2, s2);

            //SetGraphPoint(series[2], "byte");

            foreach (KeyValuePair<int, Series> serie in series)
                chart.Series.Add(serie.Value);

            //chart.SeriesTemplate.ShowInLegend = false;
            chart.Legend.Direction = LegendDirection.LeftToRight;
            chart.Legend.AlignmentHorizontal = LegendAlignmentHorizontal.Center;
            chart.Legend.AlignmentVertical = LegendAlignmentVertical.Bottom;

            DevExpress.XtraCharts.XYDiagram xyDiagram = new XYDiagram();
            xyDiagram.AxisY.Title.Font = new System.Drawing.Font("Tahoma", 8);
            xyDiagram.AxisY.Title.Text = "CZK";
            xyDiagram.AxisY.Label.Staggered = false;
            xyDiagram.AxisY.Title.Visible = true;
            xyDiagram.AxisY.Range.SideMarginsEnabled = true;
            xyDiagram.AxisY.Interlaced = true;

            xyDiagram.AxisX.Title.Font = new System.Drawing.Font("Tahoma", 8);
            xyDiagram.AxisX.Label.Staggered = true;
            xyDiagram.AxisX.Range.SideMarginsEnabled = true;
            xyDiagram.AxisX.Tickmarks.MinorVisible = false;
            chart.Diagram = xyDiagram;
            chart.Width = 700;
            chart.Height = 500;
            //chart.DataBind();
            phMain.Controls.Add(chart);
        }
示例#2
1
 public static void ComboHorizontal(dotnetCHARTING.Chart chart, int width, int height, string title, DataTable table, string xColumn, string yColumn)
 {
     SeriesCollection SC = new SeriesCollection();
     Series s = new Series();
     foreach (DataRow row in table.Rows)
     {
         string telType = row[xColumn].ToString();
         Element e = new Element();
         e.Name = telType;
         e.LabelTemplate = "%PercentOfTotal";
         e.YValue = Convert.ToDouble(row[yColumn].ToString());
         s.Elements.Add(e);
     }
     SC.Add(s);
     chart.TempDirectory = "temp";
     chart.Use3D = false;
     chart.DefaultAxis.Interval = 10;
     chart.DefaultAxis.CultureName = "zh-CN";
     chart.Palette = new Color[] { Color.FromArgb(49, 255, 49), Color.FromArgb(255, 255, 0), Color.FromArgb(255, 99, 49), Color.FromArgb(0, 156, 255) };
     chart.DefaultElement.SmartLabel.AutoWrap = true;
     chart.Type = ChartType.ComboHorizontal;
     chart.Size = width + "x" + height;
     chart.DefaultElement.SmartLabel.Text = "";
     chart.Title = title;
     chart.DefaultElement.ShowValue = true;
     chart.PieLabelMode = PieLabelMode.Outside;
     chart.ShadingEffectMode = ShadingEffectMode.Three;
     chart.NoDataLabel.Text = "û��������ʾ";
     chart.SeriesCollection.Add(SC);
 }
示例#3
0
        public static Series FileLookupInterpolate2D(Series s1, Series s2, string fileName)
        {
            var rval = new Series();

            if (s1.IsEmpty || s2.IsEmpty)
            {
                Logger.WriteLine("FileLookupInterpolate2D - input series empty");
                return rval;
            }

            if (!File.Exists(fileName))
            {
                Logger.WriteLine("FileLookupInterpolate2D - input fileName, file not found");
                return rval;
            }

            CsvFile csv = new CsvFile(fileName, CsvFile.FieldTypes.AllText);
            foreach (var pt in s1)
            {
                Point point = pt;

                var s2_idx = s2.IndexOf(pt.DateTime);
                if (s2_idx < 0)
                {
                    point.Value = Point.MissingValueFlag;
                }
                else
                {
                    point.Value = Interpoloate2D(csv, pt.Value, s2[s2_idx].Value);
                }
                rval.Add(point);
            }

            return rval;
        }
示例#4
0
        public MemoryStream BuildChart(int? type, IDictionary<string, float> dataPoints)
        {
            // default to line
            var chartType = type == null ? SeriesChartType.Line : (SeriesChartType)type;

            var chart = new Chart();

            // configure your chart area (dimensions, etc) here.
            var area = new ChartArea();
            chart.ChartAreas.Add(area);
            TickMark tm = new TickMark();

            // create and customize your data series.
            var series = new Series();
            foreach (var item in dataPoints)
            {
                series.Points.AddXY(item.Key, item.Value);
            }

            //series.Label = "#PERCENT{P0}";
            series.Font = new Font("Segoe UI", 8.0f, FontStyle.Bold);
            series.ChartType = chartType;
            series["PieLabelStyle"] = "Outside";

            chart.Series.Add(series);

            var returnStream = new MemoryStream();
            chart.ImageType = ChartImageType.Png;
            chart.SaveImage(returnStream);
            returnStream.Position = 0;

            return returnStream;
        }
示例#5
0
        public void InvalidAddition()
        {
            Series s1 = new Series(null,"cfs",TimeInterval.Daily);
            Series s2 = new Series(null,"cfs",TimeInterval.Monthly);

              Series s = s1 + s2;
        }
示例#6
0
 /// <summary>
 /// Instantiates a <see cref="TitleControl"/> with a default text
 /// </summary>
 public TitleControl(Series series)
     : this()
 {
     this.series = series;
     if (series == null)
         this.series = new Series("Add series with the button on the left", null);
 }
示例#7
0
        /// <summary>
        /// Called at the start of your algorithm to setup your requirements:
        /// </summary>
        public override void Initialize()
        {
            //Set the date range you want to run your algorithm:
            SetStartDate(startDate);
            SetEndDate(endDate);

            //Set the starting cash for your strategy:
            SetCash(100000);

            //Add any stocks you'd like to analyse, and set the resolution:
            // Find more symbols here: http://quantconnect.com/data
            AddSecurity(SecurityType.Equity, "SPY", resolution: Resolution.Minute);

            //Chart - Master Container for the Chart:
            Chart stockPlot = new Chart("Trade Plot");
            //On the Trade Plotter Chart we want 3 series: trades and price:
            Series buyOrders = new Series("Buy", SeriesType.Scatter, 0);
            Series sellOrders = new Series("Sell", SeriesType.Scatter, 0);
            Series assetPrice = new Series("Price", SeriesType.Line, 0);
            stockPlot.AddSeries(buyOrders);
            stockPlot.AddSeries(sellOrders);
            stockPlot.AddSeries(assetPrice);
            AddChart(stockPlot);

            Chart avgCross = new Chart("Strategy Equity");
            Series fastMA = new Series("FastMA", SeriesType.Line, 1);
            Series slowMA = new Series("SlowMA", SeriesType.Line, 1);
            avgCross.AddSeries(fastMA);
            avgCross.AddSeries(slowMA);
            AddChart(avgCross);

            resamplePeriod = TimeSpan.FromMinutes((endDate - startDate).TotalMinutes / 2000);
        }
        public void Apply()
        {
            ISelection selection = base.Context.Selection;
            if (selection == null || selection.Items == null)
                return;

            List<RetrieveQueryItem> queryItems = new List<RetrieveQueryItem>();
            foreach (NBIASearchResult result in selection.Items)
            {
                if (!string.IsNullOrEmpty(result.Study.StudyInstanceUid))
                {
                    RetrieveQueryItem queryItem = new RetrieveQueryItem();
                    queryItem.Study.StudyInstanceUid = result.Study.StudyInstanceUid;
                    queryItem.Patient.PatientBirthDate = result.Patient.PatientBirthDate;
                    queryItem.Patient.PatientId = result.Patient.PatientId;
                    queryItem.Patient.PatientsName = result.Patient.PatientsName;
                    queryItem.Patient.PatientsSex = result.Patient.PatientsSex;
                    Series series = new Series();
                    series.Modality = result.Series.Modality;
                    series.SeriesInstanceUid = result.Series.SeriesInstanceUid;
                    queryItem.Series.Add(series);

                    queryItems.Add(queryItem);
                }
            }

            RetrieveCoordinator.Coordinator.RetrieveStudies(queryItems);
        }
示例#9
0
        public static Series ReadCorpsDataFile(string url, TimeInterval interval, params string[] headers)
        {
            string units = headers[headers.Length - 1];
            if( units == "n (ft)") // hack for Banks Lake.
                units = "(ft)";

            Series rval = new Series(units, interval);
            rval.HasFlags = true;

            string fileName = FileUtility.GetTempFileName(".txt");
            Web.GetTextFile(url, fileName, true);

            int[] widths = new int[] { 9, 5, 9, 9, 9, 9, 9, 9, 9, 9, 9,9,9 };

            var tf = new FixedWidthTextFile(fileName, widths);

            int col, row;
            tf.FindIndexToRange(headers, out row, out col);
            if (row < 0 || col < 0)
            {
                Logger.WriteLine("Error: no index found for headers '" + String.Join("','", headers) + "'");
                return rval;
            }

            rval.Name = String.Join(" ", headers, 0, headers.Length - 1);
            ReadDataIntoSeries(tf, rval, row + headers.Length, col);

            return rval;
        }
示例#10
0
        private void Init(int waterYear)
        {
            qu = new HydrometDailySeries("HEII", "QU");
            var t1 = new DateTime(waterYear-1, 10, 1);
            var t2 = new DateTime(waterYear, 8, 1);
            if (t2 > DateTime.Now && t2.Year != 7100)
            {
                t2 = DateTime.Now.AddDays(-1);
            }
            qu.Read(t1, t2);
            // find date where (if)  20,000 cfs occurs at heii.

            for (int i = 0; i < qu.Count; i++)
            {
                Point pt = qu[i];
                if( !pt.IsMissing  && pt.Value >=20000)
                {
                    quDate20000 = pt.DateTime;
                    break;
                }
            }

            solid = FcPlotDataSet.GetPeriodicSeries("Heii.Solid");
            dashed = FcPlotDataSet.GetPeriodicSeries("Heii.Dashed");
        }
示例#11
0
        public static Series CreateSeries(string typechar, Dictionary<string, string> diction)
        {
            Series ser = null;
            Dictionary<string, string> dicts = diction;
            switch (typechar)
            {
                case "柱状图":
                    ser = new Series("", ViewType.Bar);
                    break;
                case "线状图":
                    ser = new Series("", ViewType.Line);
                    break;
                default:
                    ser = new Series("", ViewType.Bar);
                    break;
            }

            ser.ArgumentScaleType = ScaleType.Qualitative;
            foreach (var item in dicts)
            {
                SeriesPoint sp = new SeriesPoint(item.Key, item.Value);
                ser.Points.Add(sp);
            }
            SecondaryAxisY sy = new SecondaryAxisY();
            sy.GridSpacing = 1;
            return ser;
        }
示例#12
0
        public void Basic()
        {
            Series s = new Series();
            s.Add("1/1/2006", 20);
            s.Add("1/2/2006", 20);
            s.Add("1/3/2006", 20);
            s.Add("1/4/2006", 20);
            s.Add("1/5/2006", 20);
            s.Add("1/6/2006", 20);
            s.Add("1/7/2006", -40);
            s.Add("1/8/2006", 10);
            s.Add("1/9/2006", 50);
            s.Add("1/10/2006", 20);
            s.Add("1/11/2006", 20);
            s.Add("1/12/2006", 20);
            s.Add("1/13/2006", 20);
            s.Add("1/14/2006", 20);
            s.Add("1/15/2006", 20);

            DateTime t1 = DateTime.Parse("1/6/2006");
            DateTime t2 = DateTime.Parse("1/11/2006");
               // s.WriteToConsole();

            SeriesRange sr = new SeriesRange(s, t1, t2);

            double d = sr.ComputeSum(15);

            Console.WriteLine(" \n\n sr.ComputeSum(15)= "+d);
            Assert.AreEqual(107.5, d, " summed using 15 as guess for midpoint");

            sr.SmoothPreservingSum();

            Assert.AreEqual(4,sr.MidPointValue,0.01);
        }
		public void LoadSeries(Series series, Piece piece)
		{
			if(piece != null)
			{
				if(AppGlobal.CollectionsViewInListMode)
				{
					AppGlobal.CollectionsViewInListMode = false;	
				}
			}
			
			ResolveSeriesViewController(series);
			
			if(_vc.NavigationItem.TitleView != null)
			{
				_vc.NavigationItem.TitleView.Dispose();	
				_vc.NavigationItem.TitleView = null;
			}
			var label = new UILabel();
			label.Font = UIFont.BoldSystemFontOfSize(14.0f);
			label.BackgroundColor = UIColor.Clear;
			label.TextColor = UIColor.White;
			label.Text = series.Title;
			label.SizeToFit();
			_vc.NavigationItem.TitleView = label;
			
			this.NavigationController.PushViewController(_vc, true);
			
			if(piece != null)
			{
				_vc.GoToPiece(series, piece);	
			}
		}
示例#14
0
        private void checkChoose_CheckedChanged(object sender, EventArgs e)
        {
            if (checkChoose.Checked)
                dateChoose.Enabled = true;
            else
            {
                dateChoose.Enabled = false;
                Waiting.ShowWaitForm();
                Waiting.SetWaitFormDescription("Đang tải tất cả");
                chartUSSnr.Series.Clear();
                chartRemote.Series.Clear();
                Series Dssnr = new Series("DSSNR \r\n " + Mac, ViewType.Line);

                Series UsTx = new Series("USTX \r\n " + Mac, ViewType.Line);

                Series DsRx = new Series("DSRX \r\n " + Mac, ViewType.Line);

                Series UsSnr = new Series("USSNR \r\n " + Mac, ViewType.StepArea);

                Series UsNoise = new Series("", ViewType.StepArea);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Status"].ToString() == "online")
                    {

                        Dssnr.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), dt.Rows[i]["value1"].ToString()));
                        UsTx.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), dt.Rows[i]["value2"].ToString()));
                        DsRx.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), dt.Rows[i]["value3"].ToString()));
                    }
                    else
                    {
                        Dssnr.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), "0"));
                        UsTx.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), "0"));
                        DsRx.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), "0"));
                    }

                    if (dt.Rows[i]["value4"].ToString() != "")
                    {
                        UsSnr.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), dt.Rows[i]["value4"].ToString()));
                        if (int.Parse(dt.Rows[i]["value4"].ToString()) < 210)
                        {
                            UsNoise.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), dt.Rows[i]["value4"].ToString()));
                        }
                        else
                        {
                            UsNoise.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), "0"));
                        }
                    }
                    else
                    {
                        UsSnr.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), "0"));
                        UsNoise.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy H"), "0"));
                    }
                }
                chartUSSnr.Series.AddRange(new Series[] { UsSnr, UsNoise });
                chartRemote.Series.AddRange(new Series[] { UsTx, Dssnr, DsRx });
                Waiting.CloseWaitForm();
            }
        }
        // Override the AddChartSeries method to provide the chart data
        protected override void AddChartSeries()
        {
            ChartSeriesData = new List<Series>();
            var series = new Series()
            {
                ChartType = SeriesChartType.Pie,
                BorderWidth = 1
            };

            var shares = chartData.ShareData;
            foreach (var share in shares)
            {
                var point = new DataPoint();
                point.IsValueShownAsLabel = true;
                point.AxisLabel = share.Name;
                point.ToolTip = share.Name + " " +
                      share.Share.ToString("#0.##%");
                if (share.Url != null)
                {
                    point.MapAreaAttributes = "href=\"" +
                          share.Url + "\"";
                }
                point.YValues = new double[] { share.Share };
                point.LabelFormat = "P1";
                series.Points.Add(point);
            }

            ChartSeriesData.Add(series);
        }
        protected void initHeightPlot()
        {
            if (cmc == null) { cmc = new CommomMethodsClass(PersonInfo); }

            List<Double> hVal = new List<Double>();
            List<DateTime> dts = new List<DateTime>();
            List<Height> heights = cmc.GetValues<Height>(Height.TypeId);
            if (heights != null)
            {
                for (int i = 0; i < heights.Count; i++)
                {
                    hVal.Add(heights[i].Value.DisplayValue.Value);
                    dts.Add(heights[i].When.ToDateTime());
                }
            }

            Title chartTitle1 = new Title();
            chartTitle1.Text = "Height in Inches";
            hgraph.Titles.Add(chartTitle1);

            Series series4 = new Series("Spline1");
            series4.ChartType = SeriesChartType.Spline;
            series4.Points.DataBindXY(dts, hVal);
            series4.IsValueShownAsLabel = true;
            hgraph.Series.Add(series4);

            //hide grid lines
            hgraph.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
            hgraph.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false;
        }
示例#17
0
    private void BindChart(string seryName, Dictionary<string, int> pointValues)
    {
        Series se = new Series(seryName);
        se.ChartType = SeriesChartType.Bar;
           // se.ChartType = SeriesChartType.Column;
        se.XValueType = ChartValueType.String;

        Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 1;       // se.LabelFormat = "hh:mm:ss";

          // se.Label = "#PERCENT{P2}";
        //se["PieLabelStyle"] = "Outside";

        // Chart1.Legends.Add("Legend1");

        // Chart1.Legends[0].Enabled = true;

        // Chart1.Legends[0].Docking = Docking.Bottom;

        // Chart1.Legends[0].Alignment = System.Drawing.StringAlignment.Center;

        //se.LegendText = "#PERCENT{P2}";

        //一个point 表示该series在某点的数据
        se.IsValueShownAsLabel = true;
        se.Points.DataBindXY(pointValues.Keys,pointValues.Values );

        Chart1.Series.Clear();
        Chart1.Series.Add(se);
         //  Chart1.Series[0]["CollectedThresholdUsePercent"] = "true";
        /*
                Chart1.Series[0].Label = "#PERCENT{P2}";
                Chart1.Series[0]["PieLabelStyle"] = "Outside";*/
    }
示例#18
0
文件: Program.cs 项目: usbr/Pisces
        private static Series GetSerieData(Folder folder)
        {
            var s = new Series();
            s.TimeInterval = TimeInterval.Daily;
            foreach (var msg in folder.Messages)
            {
                var txt = msg.Body.Text;
                var exp = @"Pump Station Average Flow:(\s*\d{1,10}(\.){0,1}\d{0,3})\s*cfs";
                Regex re = new Regex(exp);
                var m = Regex.Match(txt, exp);
                if (m.Success)
                {
                    double d = Convert.ToDouble(m.Groups[1].Value);
                    var t = Reclamation.TimeSeries.Math.RoundToNearestHour(msg.Date.Value);

                    if (s.IndexOf(t) < 0)
                    {
                        s.Add(t, d);
                        //msg.Flags.Add(ImapX.Flags.MessageFlags.Seen);
                        msg.Flags.Add(ImapX.Flags.MessageFlags.Deleted);
                        Console.WriteLine(t.ToString() + " " + d.ToString("F2"));
                    }
                }
            }
            return s;
        }
示例#19
0
    /// <summary>
    /// 获取到所有的数据
    /// </summary>
    /// <returns></returns>
    private void BindingAllData()
    {
        ChartTitle ct = new ChartTitle();
        ct.Text = "所有调用次数统计";
        chart.Titles.Clear();
        chart.Titles.Add(ct);
        chart.SeriesTemplate.View = new PieSeriesView();

        Series series1 = new Series("Line Series 1", ViewType.Pie);
        DataTable dt = aas.GetCallNumAnalyseData();

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string title = dt.Rows[i]["BusinessFullName"].ToString();
            double num = double.Parse(dt.Rows[i]["NUM"].ToString());

            series1.Points.Add(new SeriesPoint(title, new double[] { num }));
        }

        ((PieSeriesLabel)series1.Label).Position = PieSeriesLabelPosition.Outside;
        ((PiePointOptions)series1.PointOptions).PointView = PointView.Values;
        ((PiePointOptions)series1.PointOptions).PercentOptions.ValueAsPercent = true;
        ((PiePointOptions)series1.PointOptions).ValueNumericOptions.Format = NumericFormat.Percent;
        ((PiePointOptions)series1.PointOptions).ValueNumericOptions.Precision = 0;

        series1.LegendPointOptions.PointView = PointView.ArgumentAndValues;
        series1.LegendPointOptions.ValueNumericOptions.Format = NumericFormat.FixedPoint;
        series1.LegendPointOptions.ValueNumericOptions.Precision = 0;
        ((PiePointOptions)series1.LegendPointOptions).PercentOptions.ValueAsPercent = false;

        chart.Series.Add(series1);
    }
示例#20
0
文件: TestAdd.cs 项目: usbr/Pisces
        public void AddToEmpty()
        {
            Series s1 = new Series();
            Series s2 = new Series();
            DateTime t = new DateTime(2006, 7, 11);

            Series s3 = AddTwoSeriesWithDifferentLengths(s1, s2, ref t);

            Assert.AreEqual(s3.Count, s1.Count);

            t = new DateTime(2006, 7, 11);
            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine(t);
                bool missing = true;
                if (i > 5 && i < 8)
                    missing = false;

                Assert.AreEqual(s3[i].IsMissing,missing);

                if (!missing)
                {
                    Assert.AreEqual(s1.Lookup(t) + s2.Lookup(t),3 );
                }
                t = t.AddDays(1);

            }
        }
示例#21
0
        public static void CreateChart(string imagePath,string name, IEnumerable<BenchResult> results, Func<BenchResult,double> selector)
        {
            Chart chart = new Chart();
            chart.Width = 500;
            chart.Height = 400;
            chart.Titles.Add(name);
            var area = new ChartArea("Default");
            chart.ChartAreas.Add(area);
            var series = new Series("Default");
            chart.Series.Add(series);
            area.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;
            area.AxisX.LabelStyle.TruncatedLabels = false;
            area.AxisX.Interval = 1;
            series.ChartType = SeriesChartType.Column;
            series.IsValueShownAsLabel = true;
            series.XValueType = ChartValueType.String;

            series.YValueType = ChartValueType.Int32;

            foreach(var r in results.OrderBy( r => selector(r)))
            {
                DataPoint point = new DataPoint();
                point.SetValueXY(r.Serializer.Replace("Adapter",""),(int)Math.Round(selector(r)));
                point.AxisLabel = r.Serializer.Replace("Adapter", "");
                series.Points.Add(point);
            }

            chart.SaveImage(imagePath, ChartImageFormat.Png);
        }
示例#22
0
        private void MapToShow(Show show, Series data)
        {
            show.TheTvDbId = data.Id;
            show.Name = data.SeriesName;
            show.Banner = data.Banner;
            show.ImdbId = data.ImdbId;
            show.Description = data.Overview;

            show.LastUpdated = data.LastUpdated.ToDateTime();

            AirDay airDay;
            Enum.TryParse(data.AirsDayOfWeek, out airDay);
            show.AirDay = airDay;

            ShowStatus status;
            Enum.TryParse(data.Status, out status);
            show.Status = status;

            if (!string.IsNullOrWhiteSpace(data.FirstAired))
            {
                show.FirstAired = this.DateParser.ParseFirstAired(data.FirstAired);
            }

            if (!string.IsNullOrWhiteSpace(data.AirsTime))
            {
                show.AirTime = this.DateParser.ParseAirTime(data.AirsTime);
            }
        }
示例#23
0
文件: TestAlarms.cs 项目: usbr/Pisces
        public void Below()
        {
            var ds = db.Alarms;
            ds.AddNewAlarmGroup("lucky");
            ds.alarm_definition.Addalarm_definitionRow(true, "lucky",
                "luc", "fb", "below 5525", "", 10);
            ds.SaveTable(ds.alarm_definition);
            ds.alarm_recipient.Addalarm_recipientRow("lucky", 4,
                "5272", "office", "*****@*****.**");
            ds.SaveTable(ds.alarm_recipient);

            Series s = new Series();
            s.Parameter = "fb";
            s.SiteID = "luc";
            s.Add(DateTime.Parse("2016-11-21 02:00"), 5520.12);
            s.Add(DateTime.Parse("2016-11-21 02:15"), 5520.12);
            s.Add(DateTime.Parse("2016-11-21 02:30"), 5520.12);
            s.Add(DateTime.Parse("2016-11-21 02:45"), 5520.12);

            ds.Check(s);

            var queue = ds.GetAlarmQueue();
            string sql = "list = 'lucky' AND siteid = 'luc' "
                + "AND parameter = 'fb' AND status = 'new'";
            Assert.IsTrue(queue.Select(sql).Length == 1);
        }
        public ActionResult Details(int width = 500, int height = 500)
        {
            var chart = new Chart { Height = height, Width = width };
            var chartArea = new ChartArea("Area1")
            {
                AxisX = { Interval = 1 },
                Area3DStyle = { Enable3D = true },
                BackColor = Color.Transparent
            };
            chart.ChartAreas.Add(chartArea);

            chart.BackColor = Color.Transparent;

            var seriescountAll = new Series("项目统计");
            var countAll =
                _iProjectInfoStateService.GetAll()
                    .Select(a => new { Key = a.ProjectInfoStateName, Count = a.ProjectInfos.Count(b => !b.Deleted) });
            seriescountAll.ChartArea = "Area1";
            seriescountAll.IsVisibleInLegend = true;
            seriescountAll.IsValueShownAsLabel = true;
            seriescountAll.Label = "#VALX  #VALY";
            seriescountAll.Points.DataBind(countAll, "Key", "Count", "");
            seriescountAll.ChartType = SeriesChartType.Funnel;
            chart.Series.Add(seriescountAll);

            var imageStream = new MemoryStream();
            chart.SaveImage(imageStream, ChartImageFormat.Png);
            imageStream.Position = 0;
            return new FileStreamResult(imageStream, "image/png");
        }
示例#25
0
文件: TestAlarms.cs 项目: usbr/Pisces
        public void AboveOrRising()
        {
            var ds = db.Alarms;
            ds.AddNewAlarmGroup("uny");
            ds.alarm_definition.Addalarm_definitionRow(true, "uny",
                "uny", "pc", "above 300 or rising 1", "", 10);
            ds.SaveTable(ds.alarm_definition);
            ds.alarm_recipient.Addalarm_recipientRow("uny", 4,
                "5272", "office", "*****@*****.**");
            ds.SaveTable(ds.alarm_recipient);

            Series s = new Series();
            s.Parameter = "pc";
            s.SiteID = "uny";
            s.Add(DateTime.Parse("2016-11-21 02:00"), 38002.12);
            s.Add(DateTime.Parse("2016-11-21 02:15"), 38005.02);
            s.Add(DateTime.Parse("2016-11-21 02:30"), 38002.02);
            s.Add(DateTime.Parse("2016-11-21 02:45"), 38002.02);

            ds.Check(s);

            var queue = ds.GetAlarmQueue();
            string sql = "list = 'uny' AND siteid = 'uny' "
                + "AND parameter = 'pc' AND status = 'new'";
            Assert.IsTrue(queue.Select(sql).Length == 1);
        }
示例#26
0
        public void Insert(Guid Guid, Guid ServerPartitionGUID, Guid StudyGUID, string SeriesInstanceUid,
                           string Modality, string SeriesNumber, string SeriesDescription,
                           int NumberOfSeriesRelatedInstances, string PerformedProcedureStepStartDate,
                           string PerformedProcedureStepStartTime, string SourceApplicationEntityTitle)
        {
            var item = new Series();

            item.Guid = Guid;

            item.ServerPartitionGUID = ServerPartitionGUID;

            item.StudyGUID = StudyGUID;

            item.SeriesInstanceUid = SeriesInstanceUid;

            item.Modality = Modality;

            item.SeriesNumber = SeriesNumber;

            item.SeriesDescription = SeriesDescription;

            item.NumberOfSeriesRelatedInstances = NumberOfSeriesRelatedInstances;

            item.PerformedProcedureStepStartDate = PerformedProcedureStepStartDate;

            item.PerformedProcedureStepStartTime = PerformedProcedureStepStartTime;

            item.SourceApplicationEntityTitle = SourceApplicationEntityTitle;


            item.Save(UserName);
        }
示例#27
0
        public void EqualLengths()
        {
            var pu = new Series("daily_wrdo_pu");
            pu.TimeInterval = TimeInterval.Daily;
            pu.Add("10-1-2014", 0);
            pu.Add("10-2-2014", 1);
            pu.Add("10-3-2014", 2);
            pu.Add("10-4-2014", 3);
            pu.Add("10-5-2014", 4);
            pu.Add("10-6-2014", 5);

            var pp = new Series("daily_wrdo_pp");
            pp.TimeInterval = TimeInterval.Daily;
            pp.Add("10-1-2014", 0);
            pp.Add("10-2-2014", 1);
            pp.Add("10-3-2014", 1);
            pp.Add("10-4-2014", 1);
            pp.Add("10-5-2014", 1);
            pp.Add("10-6-2014", 1);

            var puNew = Reclamation.TimeSeries.Math.DailyWaterYearRunningTotal(pp, pu);

            for (int i = 0; i < pu.Count; i++)
            {
                Assert.AreEqual(puNew[i].Value, pu[i].Value);
            }
        }
示例#28
0
    public void FillColumnChart(DataTable DT)
    {
        dataGridView1.DataSource = DT;
        dataGridView1.DataBind();

        chart2.Series.Clear();

        Series seriesAll = new Series("总收入");
        chart2.Series.Add(seriesAll);
        Series seriesLixi = new Series("利息");
        chart2.Series.Add(seriesLixi);
        Series seriesTouRu = new Series("本金");
        chart2.Series.Add(seriesTouRu);

        chart2.DataSource = DT;

        //设置图表Y轴对应项
        seriesAll.YValueMembers = "All";
        seriesLixi.YValueMembers = "Lixi";
        seriesTouRu.YValueMembers = "TouRu";

        //设置图表X轴对应项
        chart2.Series[0].XValueMember = "Time";

        //chart2.ChartAreas[0].Area3DStyle.Enable3D = true;
        //chart2.ChartAreas[0].Area3DStyle.Inclination = 30;
        //chart2.ChartAreas[0].Area3DStyle.PointDepth = 50;
        //chart2.ChartAreas[0].Area3DStyle.IsClustered = true;
        //chart2.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;

        chart2.DataBind();
    }
示例#29
0
    public void BindProductSalesChart(int year)
    {
        using (CartDataClassesDataContext context = new CartDataClassesDataContext())
        {
            var productSales = from o in context.Orders
                               where o.DatePlaced.Value.Year == year
                               group o by o.DatePlaced.Value.Month into g
                               orderby g.Key
                               select new
                               {
                                   Month = g,
                                   TopProducts = (from op in context.OrderProducts
                                                  where op.OrderDate.Value.Year == year && op.OrderDate.Value.Month == g.Key
                                                  group op by op.ProductID into opg
                                                  orderby opg.Count() descending
                                                  select new { ProductName = context.Products.Where(p => p.ProductID == opg.Key).Single().ProductName, ProductCount = opg.Count() }).Take(5)
                               };

            foreach (var sale in productSales)
            {
                Series series = new Series(Enum.Parse(typeof(Month), sale.Month.FirstOrDefault().DatePlaced.Value.Month.ToString()).ToString()) { ChartType = SeriesChartType.Bubble};
                foreach (var topProduct in sale.TopProducts){
                    DataPoint point = new DataPoint() { XValue = sale.Month.Key, YValues = new double[] { (double)topProduct.ProductCount }, Label = topProduct.ProductName };
                    series.Points.Add(point);

                }
                ProductSalesChart.Series.Add(series);
            }
        }
    }
示例#30
0
文件: frmTraffic.cs 项目: tayeumi/HFC
        private void btnXem_Click(object sender, EventArgs e)
        {
            try
            {
                Class.NW_CurrentTrafic tf = new Class.NW_CurrentTrafic();
                tf.MacAddress = txtMacaddress.Text;
                tf.Month = cbThang.EditValue.ToString();
                tf.Year = cbNam.EditValue.ToString();
                DataTable dt = tf.NW_Trafic_Get();
                gridItem.DataSource = dt;

                Series Ds = new Series("DS: KByte ", ViewType.SwiftPlot);
                Series Us = new Series("US: KByte  ", ViewType.SwiftPlot);
                Ds.Points.Clear();
                Us.Points.Clear();
                chartDS.Series.Clear();
                chartUS.Series.Clear();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Ds.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy HHmm"), dt.Rows[i]["DS"].ToString()));
                    Us.Points.Add(new SeriesPoint(((DateTime)dt.Rows[i]["DateTime"]).ToString("dd/MM/yy HHmm"), dt.Rows[i]["US"].ToString()));

                }
                chartDS.Series.AddRange(new Series[] { Ds });
                chartUS.Series.AddRange(new Series[] { Us });

            }
            catch {
                MessageBox.Show(" KHÔNG TÌM THẤY YÊU CẦU !");
            }
        }
示例#31
0
        private List <ImportResult> ProcessFile(FileInfo fileInfo, ImportMode importMode, Series series, DownloadClientItem downloadClientItem)
        {
            if (Path.GetFileNameWithoutExtension(fileInfo.Name).StartsWith("._"))
            {
                _logger.Debug("[{0}] starts with '._', skipping", fileInfo.FullName);

                return(new List <ImportResult>
                {
                    new ImportResult(new ImportDecision(new LocalEpisode {
                        Path = fileInfo.FullName
                    }, new Rejection("Invalid video file, filename starts with '._'")), "Invalid video file, filename starts with '._'")
                });
            }

            if (downloadClientItem == null)
            {
                if (_diskProvider.IsFileLocked(fileInfo.FullName))
                {
                    return(new List <ImportResult>
                    {
                        FileIsLockedResult(fileInfo.FullName)
                    });
                }
            }

            var decisions = _importDecisionMaker.GetImportDecisions(new List <string>()
            {
                fileInfo.FullName
            }, series, null, true);

            return(_importApprovedEpisodes.Import(decisions, true, downloadClientItem, importMode));
        }
示例#32
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
            System.Windows.Forms.DataVisualization.Charting.Legend    legend1    = new System.Windows.Forms.DataVisualization.Charting.Legend();
            System.ComponentModel.ComponentResourceManager            resources  = new System.ComponentModel.ComponentResourceManager(typeof(EditForm));
            this.chart1      = new System.Windows.Forms.DataVisualization.Charting.Chart();
            this.StartSlider = new NAudio.Gui.VolumeSlider();
            this.EndSlider   = new sliderBackwards(this.components);
            this.label1      = new System.Windows.Forms.Label();
            this.label2      = new System.Windows.Forms.Label();
            this.TrimButton  = new System.Windows.Forms.Button();
            this.LeftBox     = new System.Windows.Forms.RichTextBox();
            this.RightBox    = new System.Windows.Forms.RichTextBox();
            ((System.ComponentModel.ISupportInitialize)(this.chart1)).BeginInit();
            this.SuspendLayout();
            //
            // chart1
            //
            chartArea1.Name = "ChartArea1";
            this.chart1.ChartAreas.Add(chartArea1);
            legend1.Name = "Legend1";
            this.chart1.Legends.Add(legend1);
            this.chart1.Location = new System.Drawing.Point(0, 143);
            this.chart1.Name     = "chart1";
            var series1 = new Series
            {
                Name      = "Audio",
                Color     = Color.Red,
                ChartType = SeriesChartType.Line
            };

            this.chart1.Series.Add(series1);
            this.chart1.Size     = new System.Drawing.Size(776, 295);
            this.chart1.TabIndex = 0;
            this.chart1.Text     = "chart1";
            //
            // StartSlider
            //
            this.StartSlider.BackColor  = System.Drawing.Color.Red;
            this.StartSlider.ForeColor  = System.Drawing.Color.White;
            this.StartSlider.Location   = new System.Drawing.Point(77, 83);
            this.StartSlider.Name       = "StartSlider";
            this.StartSlider.Size       = new System.Drawing.Size(573, 16);
            this.StartSlider.TabIndex   = 2;
            this.StartSlider.MouseDown += new System.Windows.Forms.MouseEventHandler(this.StartSlider_MouseDown);
            this.StartSlider.MouseMove += new System.Windows.Forms.MouseEventHandler(this.StartSlider_MouseMove);
            this.StartSlider.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.StartSlider_MouseUp);
            //
            // EndSlider
            //
            this.EndSlider.BackColor  = System.Drawing.Color.LightGreen;
            this.EndSlider.Location   = new System.Drawing.Point(77, 121);
            this.EndSlider.Name       = "EndSlider";
            this.EndSlider.Size       = new System.Drawing.Size(573, 16);
            this.EndSlider.TabIndex   = 5;
            this.EndSlider.MouseDown += new System.Windows.Forms.MouseEventHandler(this.EndSlider_MouseDown);
            this.EndSlider.MouseMove += new System.Windows.Forms.MouseEventHandler(this.EndSlider_MouseMove);
            this.EndSlider.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.EndSlider_MouseUp);
            //
            // label1
            //
            this.label1.AutoSize  = true;
            this.label1.ForeColor = System.Drawing.Color.White;
            this.label1.Location  = new System.Drawing.Point(82, 102);
            this.label1.Name      = "label1";
            this.label1.Size      = new System.Drawing.Size(26, 13);
            this.label1.TabIndex  = 3;
            this.label1.Text      = "End";
            //
            // label2
            //
            this.label2.AutoSize  = true;
            this.label2.ForeColor = System.Drawing.Color.White;
            this.label2.Location  = new System.Drawing.Point(82, 67);
            this.label2.Name      = "label2";
            this.label2.Size      = new System.Drawing.Size(29, 13);
            this.label2.TabIndex  = 4;
            this.label2.Text      = "Start";
            //
            // TrimButton
            //
            this.TrimButton.FlatAppearance.BorderSize = 0;
            this.TrimButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.TrimButton.Font      = new System.Drawing.Font("Castellar", 24F);
            this.TrimButton.ForeColor = System.Drawing.Color.White;
            this.TrimButton.Location  = new System.Drawing.Point(16, 13);
            this.TrimButton.Name      = "TrimButton";
            this.TrimButton.Size      = new System.Drawing.Size(146, 51);
            this.TrimButton.TabIndex  = 6;
            this.TrimButton.Text      = "Trim";
            this.TrimButton.UseVisualStyleBackColor = true;
            this.TrimButton.Click += new System.EventHandler(this.TrimButton_Click);
            this.TrimButton.Enter += new System.EventHandler(this.ButEnter);
            this.TrimButton.Leave += new System.EventHandler(this.ButLeave);
            //
            // LeftBox
            //
            this.LeftBox.BackColor   = System.Drawing.Color.Black;
            this.LeftBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.LeftBox.Cursor      = System.Windows.Forms.Cursors.Default;
            this.LeftBox.Location    = new System.Drawing.Point(64, 161);
            this.LeftBox.Name        = "LeftBox";
            this.LeftBox.Size        = new System.Drawing.Size(10, 241);
            this.LeftBox.TabIndex    = 7;
            this.LeftBox.Text        = "";
            //
            // RightBox
            //
            this.RightBox.BackColor   = System.Drawing.Color.Black;
            this.RightBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.RightBox.Cursor      = System.Windows.Forms.Cursors.Default;
            this.RightBox.Location    = new System.Drawing.Point(651, 161);
            this.RightBox.Name        = "RightBox";
            this.RightBox.Size        = new System.Drawing.Size(10, 241);
            this.RightBox.TabIndex    = 8;
            this.RightBox.Text        = "";
            //
            // EditForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            this.BackColor           = System.Drawing.Color.Black;
            this.ClientSize          = new System.Drawing.Size(752, 450);
            this.Controls.Add(this.RightBox);
            this.Controls.Add(this.LeftBox);
            this.Controls.Add(this.TrimButton);
            this.Controls.Add(this.EndSlider);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.StartSlider);
            this.Controls.Add(this.chart1);
            this.Icon         = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name         = "EditForm";
            this.Text         = "EditForm";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.EditForm_FormClosing);
            this.Load        += new System.EventHandler(this.EditForm_Load);
            ((System.ComponentModel.ISupportInitialize)(this.chart1)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
示例#33
0
 public abstract List <ImageFileResult> SeriesImages(Series series);
示例#34
0
 public abstract MetadataFileResult EpisodeMetadata(Series series, EpisodeFile episodeFile);
示例#35
0
 public abstract MetadataFileResult SeriesMetadata(Series series);
示例#36
0
 public abstract MetadataFile FindMetadataFile(Series series, string path);
示例#37
0
 public void get_series_by_unknown_id_should_return_404()
 {
     var result = Series.InvalidGet(1000000);
 }
示例#38
0
        private void LoadGraph()
        {
            ChartArea chartArea1 = new ChartArea();

            chart1.Series.Clear();
            Legend legend1 = new Legend();

            this.chart1.BackColor            = Color.FromArgb(((int)(((byte)(211)))), ((int)(((byte)(223)))), ((int)(((byte)(240)))));
            this.chart1.BackGradientStyle    = GradientStyle.TopBottom;
            this.chart1.BackSecondaryColor   = Color.White;
            this.chart1.BorderlineColor      = Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
            this.chart1.BorderlineDashStyle  = ChartDashStyle.Solid;
            this.chart1.BorderlineWidth      = 2;
            this.chart1.BorderSkin.SkinStyle = BorderSkinStyle.Emboss;

            #region ChartArea Properties

            chartArea1.Area3DStyle.Enable3D         = true;
            chartArea1.Area3DStyle.Inclination      = 38;
            chartArea1.Area3DStyle.IsClustered      = true;
            chartArea1.Area3DStyle.IsRightAngleAxes = false;
            chartArea1.Area3DStyle.LightStyle       = LightStyle.Realistic;
            chartArea1.Area3DStyle.Perspective      = 10;
            chartArea1.Area3DStyle.PointDepth       = 200;
            chartArea1.Area3DStyle.Rotation         = 9;
            chartArea1.Area3DStyle.WallWidth        = 0;
            chartArea1.AxisX.IntervalAutoMode       = IntervalAutoMode.VariableCount;
            chartArea1.AxisY.IntervalAutoMode       = IntervalAutoMode.VariableCount;

            chartArea1.AxisX.MinorGrid.Enabled = true;
            chartArea1.AxisY.MinorGrid.Enabled = true;

            chartArea1.AxisX.LabelStyle.Font = new Font("Cambria", 8.25F, FontStyle.Bold);

            chartArea1.BackGradientStyle  = GradientStyle.TopBottom;
            chartArea1.BackSecondaryColor = Color.White;
            chartArea1.BorderColor        = Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
            chartArea1.BorderDashStyle    = ChartDashStyle.Solid;
            //chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;

            #endregion

            var allYearsArray = growingValues.Keys.ToArray <int>();

            // FOSSIL FUELS
            if (chkFossila.Checked)
            {
                Series fossils = new Series();
                fossils.ChartType = SeriesChartType.Spline;
                fossils.Points.DataBindXY(allYearsArray, growingValues.Values.Select(w => w.GetValue(0)).ToArray());
                fossils.Color       = Color.Blue;
                fossils.BorderWidth = 2;
                fossils.Name        = "Fossila Bränslen";
                chart1.Series.Add(fossils);
            }

            // BIO FUELS
            if (chkBio.Checked)
            {
                Series bio = new Series();
                bio.ChartType = SeriesChartType.Spline;
                bio.Points.DataBindXY(allYearsArray, growingValues.Values.Select(w => w.GetValue(1)).ToArray());
                bio.Color       = Color.Red;
                bio.BorderWidth = 2;
                bio.Name        = "Bio Bränslen";
                chart1.Series.Add(bio);
            }

            // WIND ENERGY
            if (chkVind.Checked)
            {
                Series wind = new Series();
                wind.ChartType = SeriesChartType.Spline;
                wind.Points.DataBindXY(allYearsArray, growingValues.Values.Select(w => w.GetValue(2)).ToArray());
                wind.Color       = Color.Green;
                wind.BorderWidth = 2;
                wind.Name        = "Vindkraft";
                chart1.Series.Add(wind);
            }


            // WATER ENERGY
            if (chkVatten.Checked)
            {
                Series vatten = new Series();
                vatten.ChartType = SeriesChartType.Spline;
                vatten.Points.DataBindXY(allYearsArray, growingValues.Values.Select(w => w.GetValue(3)).ToArray());
                vatten.Color       = Color.Black;
                vatten.BorderWidth = 2;
                vatten.Name        = "Vattenkraft";
                chart1.Series.Add(vatten);
            }

            // NUCLEAR ENERGY
            if (chkKarn.Checked)
            {
                Series nuclear = new Series();
                nuclear.ChartType = SeriesChartType.Spline;
                nuclear.Points.DataBindXY(allYearsArray, growingValues.Values.Select(w => w.GetValue(4)).ToArray());
                nuclear.Color       = Color.Brown;
                nuclear.BorderWidth = 2;
                nuclear.Name        = "Kärnkraft";
                chart1.Series.Add(nuclear);
            }

            ReloadDataGridView(2050);
        }
 public void RemoveSeries(Series series)
 {
     this.seriesEvents.Remove(series.Id);
 }
示例#40
0
        public List <ImportResult> ProcessPath(string path, ImportMode importMode = ImportMode.Auto, Series series = null, DownloadClientItem downloadClientItem = null)
        {
            if (_diskProvider.FolderExists(path))
            {
                var directoryInfo = new DirectoryInfo(path);

                if (series == null)
                {
                    return(ProcessFolder(directoryInfo, importMode, downloadClientItem));
                }

                return(ProcessFolder(directoryInfo, importMode, series, downloadClientItem));
            }

            if (_diskProvider.FileExists(path))
            {
                var fileInfo = new FileInfo(path);

                if (series == null)
                {
                    return(ProcessFile(fileInfo, importMode, downloadClientItem));
                }

                return(ProcessFile(fileInfo, importMode, series, downloadClientItem));
            }

            _logger.Error("Import failed, path does not exist or is not accessible by Sonarr: {0}", path);
            return(new List <ImportResult>());
        }
示例#41
0
 public static TraktShowCollected FindMatch(Series item, IEnumerable <TraktShowCollected> results)
 {
     return(results.FirstOrDefault(i => IsMatch(item, i.Show)));
 }
        private void Btn_Performance_Click(object sender, EventArgs e)
        {
            solidGaugeTRG.Visible = true;
            label3.Visible        = true;
            solidGaugeTC.Visible  = true;
            label2.Visible        = true;
            chart1.Visible        = true;

            if (TxtDate.Text == "Date")
            {
                MessageBox.Show("Entrer la Date d'aujourd'hui d'abord et cliquer sur le button Performance  ", "Lire le Guide ", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                BL.CDB db = new BL.CDB();
                db.openConnection();



                // a modifer pour chaque Poste

                MySqlDataAdapter asdf = new MySqlDataAdapter("SELECT * from saisie_poste WHERE Date = '" + TxtDate.Text + "' AND Nom_Atelier='Triangle'", db.getConnection());
                DataTable        ss   = new DataTable();
                asdf.Fill(ss);
                TxtNomAtelier.Text = ss.Rows[0][1].ToString();
                string v  = ss.Rows[0][3].ToString();        // get PC from saisie_poste
                string w  = ss.Rows[0][4].ToString();        //get PNC from saisie_poste
                string tk = ss.Rows[0][6].ToString();        // get TKT from saisie_poste

                int sum = int.Parse(w) + int.Parse(v);       //calcule de la QT
                TxtQteProduite.Text = sum.ToString();        //set QT dans TXTBOX

                string t = ss.Rows[0][9].ToString();         // get time from saisie_poste

                decimal ct  = (decimal)int.Parse(t) / (sum); // calcule de cycle time
                decimal ctr = Math.Round(ct, 2);
                TxtCycleTime.Text = ctr.ToString();          // set cycle time dans TXTBOX



                decimal tkct   = Math.Abs(int.Parse(tk) - ct); //calcule de TKTvsCT
                decimal tktctr = Math.Round(tkct, 2);

                if (tktctr <= 3)
                {
                    TxtPer_TKTCT.Text      = tktctr.ToString(); //set TKTCT dans txtbox
                    TxtPer_TKTCT.ForeColor = Color.DarkGreen;
                    button3.Visible        = true;
                }
                else
                {
                    TxtPer_TKTCT.Text      = tktctr.ToString(); //set TKTCT dans txtbox
                    TxtPer_TKTCT.ForeColor = Color.Crimson;
                    button4.Visible        = true;
                }



                decimal Trg  = (decimal)(int.Parse(v) * ct) * 100 / 1207; // calcule TRG
                decimal Trgr = Math.Round(Trg, 2);                        // round with two number

                solidGaugeTRG.Uses360Mode = false;
                solidGaugeTRG.From        = 0;
                solidGaugeTRG.To          = 100;
                solidGaugeTRG.Value       = (double)(decimal)Trgr;


                if (Trgr >= 70)
                {
                    TxtPer_TRG.Text      = Trgr.ToString(); //  set %TRG to TXTBOX
                    TxtPer_TRG.ForeColor = Color.DarkGreen;
                    button8.Visible      = true;
                }
                else
                {
                    TxtPer_TRG.Text      = Trgr.ToString(); //  set %TRG to TXTBOX
                    TxtPer_TRG.ForeColor = Color.Crimson;
                    button7.Visible      = true;
                }



                decimal tc  = (decimal)(int.Parse(v) * 100 / sum); // calcule TC
                decimal tcr = Math.Round(tc, 2);                   // round with two number

                solidGaugeTC.Uses360Mode = false;
                solidGaugeTC.From        = 0;
                solidGaugeTC.To          = 100;
                solidGaugeTC.Value       = (double)(decimal)tcr;



                if (tcr > 80)
                {
                    TxtPer_TauxConfor.Text = tcr.ToString(); // set %CONFORMITe to TXTBOX

                    TxtPer_TauxConfor.ForeColor = Color.DarkGreen;
                    button6.Visible             = true;
                }
                else
                {
                    TxtPer_TauxConfor.Text = tcr.ToString(); // set %CONFORMITe to TXTBOX

                    TxtPer_TauxConfor.ForeColor = Color.Crimson;
                    button5.Visible             = true;
                }



                //close the connection
                db.closeConnection();



                db.openConnection();

                // get valeur de stock triangle

                MySqlDataAdapter asdf1 = new MySqlDataAdapter("SELECT * from stock_poste WHERE Date = '" + TxtDate.Text + "'", db.getConnection());
                DataTable        ss1   = new DataTable();
                asdf1.Fill(ss1);
                string s = ss1.Rows[0][5].ToString(); // a modifier pour chaque poste
                if (int.Parse(s) <= 4)
                {
                    TxtPer_StockEC_Atelier.Text      = s.ToString();
                    TxtPer_StockEC_Atelier.ForeColor = Color.DarkGreen;
                    button10.Visible = true;
                }
                else
                {
                    TxtPer_StockEC_Atelier.Text      = s.ToString();
                    TxtPer_StockEC_Atelier.ForeColor = Color.Crimson;
                    button9.Visible = true;
                }
                //--------------------------------------------------------------------------------------------------------------------
                MySqlDataAdapter asdf2 = new MySqlDataAdapter("SELECT Striangle ,Date from stock_poste ", db.getConnection());
                DataSet          ds    = new DataSet();

                asdf2.Fill(ds, "Striangle");
                chart1.DataSource = ds.Tables["Striangle"];
                Series series1 = chart1.Series["Series1"];
                series1.ChartType = SeriesChartType.Column;

                series1.Name = "Stock Poste Triangle";

                var chart = chart1;
                chart.Series[series1.Name].XValueMember  = "Date";
                chart.Series[series1.Name].YValueMembers = "Striangle";

                chart.Series[0].IsValueShownAsLabel      = true;
                chart.Series[0]["pieLabelStyle"]         = "outside";
                chart.Series[0].BorderWidth              = 1;
                chart.Series[0].BorderColor              = Color.Black;
                chart.ChartAreas[0].Area3DStyle.Enable3D = true;



                db.closeConnection();



                //show labels

                labelCT.Visible    = true;
                labelQt.Visible    = true;
                labelSec.Visible   = true;
                labelTC.Visible    = true;
                labelTKTCT.Visible = true;
                labelTrg.Visible   = true;
            }
        }
示例#43
0
        protected void bindChart(int advisorBranchId, int branchHeadId, int all)
        {
            AdvisorBranchBo advisorBranchBo = new AdvisorBranchBo();
            CustomerVo      customerVo      = new CustomerVo();
            CustomerBo      customerBo      = new CustomerBo();
            Legend          Branchlegend    = null;

            Branchlegend         = new Legend("BranchAssetsLegends");
            Branchlegend.Enabled = true;
            string[]  XValues = null;
            decimal[] YValues = null;
            DataRow   drChAssets;
            DataRow   drChvalues;
            Series    seriesBranchAssets = null;

            seriesBranchAssets = new Series("seriesBranchAssets");
            double DAssetvalue = 0;
            int    j           = 0;

            if (branchAumDT.Rows.Count > 0)
            {
                lblChartBranchAUM.Visible = true;
                ErrorMessage.Visible      = false;
                drChvalues = branchAumDT.Rows[0];
                for (int i = 0; i < branchAumDT.Columns.Count - 1; i++)
                {
                    drChAssets = branchAumDT.NewRow();

                    branchAumDT.Rows.Add(drChAssets);
                    if (DAssetvalue == 0)
                    {
                        j = j + 1;
                    }
                }
                if (j != branchAumDT.Columns.Count)
                {
                    seriesBranchAssets.ChartType = SeriesChartType.Pie;
                    //seriesBranchAssets1.Palette = ChartColorPalette.Chocolate;
                    //seriesBranchAssets.Palette = ChartColorPalette.Chocolate;

                    XValues = new string[10];
                    YValues = new decimal[10];
                    ChartBranchAssets.Series.Clear();
                    ChartBranchAssets.DataSource = branchAumDT;
                    //branchAumDT.DefaultView.Sort = "CurrentValue";
                    ChartBranchAssets.Series.Clear();
                    ChartBranchAssets.Series.Add(seriesBranchAssets);
                    ChartBranchAssets.Series[0].XValueMember  = "Asset";
                    ChartBranchAssets.Series[0].XValueType    = ChartValueType.String;
                    ChartBranchAssets.Series[0].YValueMembers = "CurrentValue";
                    ChartBranchAssets.Series["seriesBranchAssets"].IsValueShownAsLabel = true;
                    ChartBranchAssets.ChartAreas[0].AxisX.Title = "Assets";
                    ChartBranchAssets.Series[0].XValueMember    = "Asset";
                    ChartBranchAssets.DataManipulator.Sort(PointSortOrder.Descending, "Y", seriesBranchAssets);
                    ChartBranchAssets.Legends.Add(Branchlegend);
                    ChartBranchAssets.Legends["BranchAssetsLegends"].Title               = "Assets";
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleAlignment      = StringAlignment.Center;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleSeparator      = LegendSeparatorStyle.None;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].Alignment           = StringAlignment.Center;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleSeparator      = LegendSeparatorStyle.GradientLine;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].TitleSeparatorColor = Color.Black;


                    ChartBranchAssets.Series[0]["PieLabelStyle"] = "Outside";
                    ChartBranchAssets.Series[0]["PieStartAngle"] = "10";
                    ChartArea chartArea1 = ChartBranchAssets.ChartAreas[0];
                    chartArea1.Area3DStyle.IsClustered      = true;
                    chartArea1.Area3DStyle.Enable3D         = true;
                    chartArea1.Area3DStyle.Perspective      = 10;
                    chartArea1.Area3DStyle.PointGapDepth    = 900;
                    chartArea1.Area3DStyle.IsRightAngleAxes = false;
                    chartArea1.Area3DStyle.WallWidth        = 25;
                    chartArea1.Area3DStyle.Rotation         = 65;
                    chartArea1.Area3DStyle.Inclination      = 35;
                    chartArea1.BackColor          = System.Drawing.Color.Transparent;
                    chartArea1.BackSecondaryColor = System.Drawing.Color.Transparent;
                    chartArea1.Position.Auto      = true;
                    LegendCellColumn colorColumn = new LegendCellColumn();
                    colorColumn.ColumnType      = LegendCellColumnType.SeriesSymbol;
                    colorColumn.HeaderBackColor = Color.WhiteSmoke;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].CellColumns.Add(colorColumn);
                    ChartBranchAssets.Legends["BranchAssetsLegends"].BackColor = Color.FloralWhite;
                    LegendCellColumn totalColumn = new LegendCellColumn();
                    totalColumn.Alignment = ContentAlignment.MiddleLeft;

                    totalColumn.Text            = "#VALX: #PERCENT";
                    totalColumn.Name            = "AssetsColumn";
                    totalColumn.HeaderBackColor = Color.WhiteSmoke;
                    ChartBranchAssets.Legends["BranchAssetsLegends"].CellColumns.Add(totalColumn);
                    ChartBranchAssets.Series[0]["PieLabelStyle"]         = "Disabled";
                    ChartBranchAssets.Series[0].ToolTip                  = "#VALX: #PERCENT";
                    ChartBranchAssets.ChartAreas[0].AxisX.Interval       = 1;
                    ChartBranchAssets.ChartAreas[0].AxisY.Title          = "Total Assets";
                    ChartBranchAssets.ChartAreas[0].Area3DStyle.Enable3D = true;
                    ChartBranchAssets.DataBind();
                }
            }
            else
            {
                lblChartBranchAUM.Visible    = false;
                ErrorMessage.Visible         = true;
                ChartBranchAssets.DataSource = null;
                ChartBranchAssets.Visible    = false;
            }


            /* For Chart 2 */

            if (topFiveRMDT.Rows.Count > 0)
            {
                lblTop5Rms.Visible = true;
                DataRow drRMCustomersNet;
                DataRow drRMCustomersNetResults;


                Series seriesRMCustNetworth = null;
                seriesRMCustNetworth = new Series("seriesRMCustNetworth");

                Series seriesRMCustNetworth1 = null;
                seriesRMCustNetworth1 = new Series("seriesRMCustNetworth");

                Legend RMCustNetLegend = null;
                Branchlegend = new Legend("legendsTopfiveRM");

                seriesRMCustNetworth    = new Series("CustomerNetworth");
                RMCustNetLegend         = new Legend("CustomerNetworthLegends");
                RMCustNetLegend.Enabled = true;
                XValues          = new string[10];
                YValues          = new decimal[10];
                drRMCustomersNet = topFiveRMDT.Rows[0];
                CharttopfiveRMCustNetworth.Series.Clear();
                CharttopfiveRMCustNetworth.Series.Add(seriesRMCustNetworth);
                CharttopfiveRMCustNetworth.DataSource = topFiveRMDT.DefaultView;
                topFiveRMDT.Columns.Add("RM Name");
                for (int i = 0; i < topFiveRMDT.Rows.Count; i++)
                {
                    drRMCustomersNet        = topFiveRMDT.NewRow();
                    drRMCustomersNetResults = topFiveRMDT.Rows[i];

                    j = j + 1;
                }
                if (j != topFiveRMDT.Rows.Count)
                {
                    seriesRMCustNetworth.ChartType = SeriesChartType.Bar;
                    //CharttopfiveRMCustNetworth.Titles.Add("Top 5 RMs (Customer Base)");


                    CharttopfiveRMCustNetworth.Series.Clear();
                    CharttopfiveRMCustNetworth.Series.Add(seriesRMCustNetworth);
                    CharttopfiveRMCustNetworth.Series[0].XValueMember = "RmName";
                    CharttopfiveRMCustNetworth.Series[0].XValueType   = ChartValueType.String;

                    CharttopfiveRMCustNetworth.Series[0].YValueMembers = "Customer_networth";


                    CharttopfiveRMCustNetworth.Series["CustomerNetworth"].IsValueShownAsLabel = true;
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisX.Title             = "RM Name";
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.WordWrap;
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep90;

                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisX.Interval       = 1;
                    CharttopfiveRMCustNetworth.ChartAreas[0].AxisY.Title          = "Customer NetWorth";
                    CharttopfiveRMCustNetworth.ChartAreas[0].Area3DStyle.Enable3D = true;

                    //CharttopfiveRMCustNetworth.Legends.Add(Branchlegend);
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].Title = "Assets";
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].TitleAlignment = StringAlignment.Center;
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].TitleSeparator = LegendSeparatorStyle.None;
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].Alignment = StringAlignment.Center;
                    //CharttopfiveRMCustNetworth.Legends["legendsTopfiveRM"].TitleSeparatorColor = Color.Black;

                    ChartArea custArea = ChartBranchAssets.ChartAreas[0];
                    custArea.Area3DStyle.Perspective      = 10;
                    custArea.Area3DStyle.PointGapDepth    = 900;
                    custArea.Area3DStyle.IsRightAngleAxes = false;
                    custArea.Area3DStyle.WallWidth        = 25;
                    custArea.Area3DStyle.Rotation         = 85;
                    custArea.Area3DStyle.Inclination      = 35;

                    seriesRMCustNetworth.Palette = ChartColorPalette.Chocolate;
                    //seriesRMCustNetworth1.Palette = ChartColorPalette.Fire;


                    //seriesRMCustNetworth.Palette = ChartColorPalette.Pastel;
                    //seriesRMCustNetworth1.Palette = ChartColorPalette.Fire;
                    CharttopfiveRMCustNetworth.DataBind();
                }
            }
            else
            {
                lblTop5Rms.Visible = false;
                CharttopfiveRMCustNetworth.DataSource = null;
                CharttopfiveRMCustNetworth.Visible    = false;
            }
            /* *********** */


            /* For Chart 3 */

            if (topFiveCustomerDT.Rows.Count > 0)
            {
                chartCustNetworth.Visible = true;
                DataRow drNetworth;
                DataRow drNetworthResult;

                Series seriesCustNetworth = null;
                seriesCustNetworth = new Series("seriesCustNetworth");

                Series seriesCustNetworth1 = null;
                seriesCustNetworth1 = new Series("seriesCustNetworth");

                Legend CustNetLegend = null;
                Branchlegend = new Legend("legendCustomeAsset");

                seriesCustNetworth    = new Series("CustomerNetworth");
                CustNetLegend         = new Legend("CustomerNetworthLegends");
                CustNetLegend.Enabled = true;
                XValues    = new string[10];
                YValues    = new decimal[10];
                drNetworth = topFiveCustomerDT.Rows[0];
                ChartCustomerNetworth.Series.Clear();
                ChartCustomerNetworth.Series.Add(seriesCustNetworth);
                ChartCustomerNetworth.DataSource = topFiveCustomerDT.DefaultView;
                topFiveCustomerDT.Columns.Add("Customer Name");
                for (int i = 0; i < topFiveCustomerDT.Rows.Count; i++)
                {
                    drNetworth       = topFiveCustomerDT.NewRow();
                    drNetworthResult = topFiveCustomerDT.Rows[i];

                    j = j + 1;
                }
                if (j != topFiveCustomerDT.Rows.Count)
                {
                    seriesCustNetworth.ChartType = SeriesChartType.Bar;

                    ChartCustomerNetworth.Series.Clear();
                    ChartCustomerNetworth.Series.Add(seriesCustNetworth);
                    ChartCustomerNetworth.Series[0].XValueMember  = "Customer";
                    ChartCustomerNetworth.Series[0].XValueType    = ChartValueType.String;
                    ChartCustomerNetworth.Series[0].YValueMembers = "Networth";



                    ChartCustomerNetworth.Series["CustomerNetworth"].IsValueShownAsLabel = true;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.Title = "Customer Name";

                    ChartCustomerNetworth.ChartAreas[0].AxisY.LabelAutoFitStyle       = LabelAutoFitStyles.LabelsAngleStep90;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.Interval                = 1;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.LabelAutoFitStyle       = LabelAutoFitStyles.WordWrap;
                    ChartCustomerNetworth.ChartAreas[0].AxisX.LabelAutoFitMaxFontSize = 5;
                    ChartCustomerNetworth.ChartAreas[0].AxisY.Title          = "Customer NetWorth";
                    ChartCustomerNetworth.ChartAreas[0].Area3DStyle.Enable3D = true;

                    ChartArea custArea = ChartBranchAssets.ChartAreas[0];
                    custArea.Area3DStyle.Perspective      = 10;
                    custArea.Area3DStyle.PointGapDepth    = 900;
                    custArea.Area3DStyle.IsRightAngleAxes = false;
                    custArea.Area3DStyle.WallWidth        = 25;
                    custArea.Area3DStyle.Rotation         = 65;
                    custArea.Area3DStyle.Inclination      = 35;
                    //seriesCustNetworth.Palette = ChartColorPalette.Pastel;
                    seriesCustNetworth.Palette = ChartColorPalette.Chocolate;
                    ChartCustomerNetworth.DataBind();
                }
            }
            else
            {
                chartCustNetworth.Visible        = false;
                ChartCustomerNetworth.DataSource = null;
                ChartCustomerNetworth.Visible    = false;
            }
            /* *********** */
        }
示例#44
0
        private List <ImportResult> ProcessFolder(DirectoryInfo directoryInfo, ImportMode importMode, Series series, DownloadClientItem downloadClientItem)
        {
            if (_seriesService.SeriesPathExists(directoryInfo.FullName))
            {
                _logger.Warn("Unable to process folder that is mapped to an existing show");
                return(new List <ImportResult>());
            }

            var cleanedUpName = GetCleanedUpFolderName(directoryInfo.Name);
            var folderInfo    = Parser.Parser.ParseTitle(directoryInfo.Name);

            if (folderInfo != null)
            {
                _logger.Debug("{0} folder quality: {1}", cleanedUpName, folderInfo.Quality);
            }

            var videoFiles = _diskScanService.GetVideoFiles(directoryInfo.FullName);

            if (downloadClientItem == null)
            {
                foreach (var videoFile in videoFiles)
                {
                    if (_diskProvider.IsFileLocked(videoFile))
                    {
                        return(new List <ImportResult>
                        {
                            FileIsLockedResult(videoFile)
                        });
                    }
                }
            }

            var decisions     = _importDecisionMaker.GetImportDecisions(videoFiles.ToList(), series, folderInfo, true);
            var importResults = _importApprovedEpisodes.Import(decisions, true, downloadClientItem, importMode);

            if ((downloadClientItem == null || !downloadClientItem.IsReadOnly) &&
                importResults.Any(i => i.Result == ImportResultType.Imported) &&
                ShouldDeleteFolder(directoryInfo, series))
            {
                _logger.Debug("Deleting folder after importing valid files");
                _diskProvider.DeleteFolder(directoryInfo.FullName, true);
            }

            return(importResults);
        }
        private void Resize()
        {
            if (_chartReport.InvokeRequired)
            {
                _chartReport.Invoke(new Action(Resize));
                return;
            }

            Series profitSeries = _chartReport.Series.FindByName("SeriesProfit");

            ChartArea area = _chartReport.ChartAreas[0];

            if (profitSeries == null ||
                profitSeries.Points == null ||
                profitSeries.Points.Count < 1)
            {
                return;
            }

            int firstX = 0;                         // first candle displayed/первая отображаемая свеча
            int lastX  = profitSeries.Points.Count; // последняя отображаемая свеча

            if (_chartReport.ChartAreas[0].AxisX.ScrollBar.IsVisible)
            {// if you have already selected a range, assign the first and last based on this range/если уже выбран какой-то диапазон, назначаем первую и последнюю исходя из этого диапазона
                firstX = Convert.ToInt32(area.AxisX.ScaleView.Position);
                lastX  = Convert.ToInt32(area.AxisX.ScaleView.Position) +
                         Convert.ToInt32(area.AxisX.ScaleView.Size) + 1;
            }

            if (firstX < 0)
            {
                firstX = 0;
                lastX  = firstX +
                         Convert.ToInt32(area.AxisX.ScaleView.Size) + 1;
            }

            if (firstX == lastX ||
                firstX > lastX ||
                firstX < 0 ||
                lastX <= 0)
            {
                return;
            }

            double max = 0;
            double min = double.MaxValue;

            for (int i = firstX; profitSeries.Points != null && i < profitSeries.Points.Count && i < lastX; i++)
            {
                if (profitSeries.Points[i].YValues.Max() > max)
                {
                    max = profitSeries.Points[i].YValues.Max();
                }
                if (profitSeries.Points[i].YValues.Min() < min && profitSeries.Points[i].YValues.Min() != 0)
                {
                    min = profitSeries.Points[i].YValues.Min();
                }
            }


            if (min == double.MaxValue ||
                max == 0 ||
                max == min ||
                max < min)
            {
                return;
            }

            area.AxisY2.Maximum = max;
            area.AxisY2.Minimum = min;
        }
示例#46
0
 public virtual void OnRename(Series series)
 {
 }
        public virtual ImportExistingExtraFileFilterResult <TExtraFile> FilterAndClean(Series series, List <string> filesOnDisk, List <string> importedFiles)
        {
            var seriesFiles = _extraFileService.GetFilesBySeries(series.Id);

            Clean(series, filesOnDisk, importedFiles, seriesFiles);

            return(Filter(series, filesOnDisk, importedFiles, seriesFiles));
        }
        /// <summary>
        /// create chart
        /// создать чарт
        /// </summary>
        private void CreateChart()
        {
            if (!HostPortfolio.Dispatcher.CheckAccess())
            {
                HostPortfolio.Dispatcher.Invoke(CreateChart);
                return;
            }

            _chartReport        = new Chart();
            HostPortfolio.Child = _chartReport;
            HostPortfolio.Child.Show();

            _chartReport.Series.Clear();
            _chartReport.ChartAreas.Clear();

            ChartArea areaLineProfit = new ChartArea("ChartAreaProfit");

            areaLineProfit.Position.Height = 70;
            areaLineProfit.Position.Width  = 100;
            areaLineProfit.Position.Y      = 0;
            areaLineProfit.CursorX.IsUserSelectionEnabled = false;
            areaLineProfit.CursorX.IsUserEnabled          = false;
            areaLineProfit.AxisX.Enabled = AxisEnabled.False;

            _chartReport.ChartAreas.Add(areaLineProfit);

            Series profit = new Series("SeriesProfit");

            profit.ChartType    = SeriesChartType.Line;
            profit.Color        = Color.DeepSkyBlue;
            profit.YAxisType    = AxisType.Secondary;
            profit.ChartArea    = "ChartAreaProfit";
            profit.ShadowOffset = 2;
            _chartReport.Series.Add(profit);

            ChartArea areaLineProfitBar = new ChartArea("ChartAreaProfitBar");

            areaLineProfitBar.AlignWithChartArea = "ChartAreaProfit";
            areaLineProfitBar.Position.Height    = 30;
            areaLineProfitBar.Position.Width     = 100;
            areaLineProfitBar.Position.Y         = 70;
            areaLineProfitBar.AxisX.Enabled      = AxisEnabled.False;


            _chartReport.ChartAreas.Add(areaLineProfitBar);

            Series profitBar = new Series("SeriesProfitBar");

            profitBar.ChartType    = SeriesChartType.Column;
            profitBar.YAxisType    = AxisType.Secondary;
            profitBar.ChartArea    = "ChartAreaProfitBar";
            profitBar.ShadowOffset = 2;
            _chartReport.Series.Add(profitBar);

            _chartReport.BackColor = Color.FromArgb(-15395563);

            for (int i = 0; _chartReport.ChartAreas != null && i < _chartReport.ChartAreas.Count; i++)
            {
                _chartReport.ChartAreas[i].BackColor            = Color.FromArgb(-15395563);
                _chartReport.ChartAreas[i].BorderColor          = Color.FromArgb(-16701360);
                _chartReport.ChartAreas[i].CursorY.LineColor    = Color.DimGray;
                _chartReport.ChartAreas[i].CursorX.LineColor    = Color.DimGray;
                _chartReport.ChartAreas[i].AxisX.TitleForeColor = Color.DimGray;

                foreach (var axe in _chartReport.ChartAreas[i].Axes)
                {
                    axe.LabelStyle.ForeColor = Color.DimGray;
                }
            }
        }
示例#49
0
    public void UpdateData()
    {
        // Update X-Axis Labels
        //List<string> labels = GameState.csvList.xLabels;
        if (labels == null)
        {
            Debug.LogError("Invalid data submitted to GraphUnit::UpdateDate()");
            return;
        }
        for (int i = 0; i < labels.Count; i++)
        {
            int    month = int.Parse(labels [i]);
            string name  = DateTimeFormatInfo.CurrentInfo.GetMonthName((month - 1) % 12 + 1).Substring(0, 3);

            if (xAxisLabels.Count != labels.Count)
            {
                xAxisLabels.Add(name + ((month - 1) % 12 == 0 ? "\n'0" + (month / 12 + 1) : ""));
            }
            else if (xAxisLabels [i] != name)
            {
                xAxisLabels [i] = name;
            }
        }

        // Update Values
        float yMaxValue = 1;

        //CSVObject csv = GameState.csvList;
        foreach (KeyValuePair <string, List <string> > entry in csv.csvList)
        {
            string        name   = entry.Key;
            List <string> values = entry.Value;

            if (name == ".xLabels")
            {
                continue;
            }

            if (!seriesList.ContainsKey(name))
            {
                Rect seriesRect = new Rect(0, 0, 0, graphRect.height);
                //moved color setting to ConvergeManager.SetColors();
                //Color color = new Color (Random.Range (0.2f, 1.0f), Random.Range (0.2f, 1.0f), Random.Range (0.2f, 1.0f));

                seriesList [name] = new Series(name, seriesRect, Color.white);                   //not using this color var
                if (!isFirstGraph)
                {
                    convergeManager.seriesLabels.Add(name);
                    //convergeManager.seriesColors [name] = color;
                    //convergeManager.seriesColorsHex [name] = Functions.ColorToHex(color);

                    if (convergeManager.lastSeriesToDraw == null)
                    {
                        convergeManager.lastSeriesToDraw = name;
                    }
                }
            }

            List <float> temp = seriesList [name].values;
            for (int i = 0; i < values.Count - 1; i++)               // Exclude Last Point
            {
                float value = (values [i] == "" ? -1f : float.Parse(values [i]));

                if (temp.Count != values.Count)
                {
                    temp.Add(value);
                }
                else if (!Mathf.Approximately(temp [i], value))
                {
                    temp [i] = value;
                }

                yMaxValue = Mathf.Max(value, yMaxValue);
            }
        }

        if (!isFirstGraph)
        {
            convergeManager.SortLabelsAndNodes();
            convergeManager.SetColors();
        }

        int roundTo = int.Parse("5".PadRight(((int)yMaxValue).ToString().Length - 1, '0'));

        yRangeActual = Mathf.CeilToInt(yMaxValue / roundTo) * roundTo;
        yRange       = yRangeActual;
    }
 public abstract IEnumerable <ExtraFile> ProcessFiles(Series series, List <string> filesOnDisk, List <string> importedFiles);
示例#51
0
 private void GivenNewSeriesInfo(Series series)
 {
     Mocker.GetMock <IProvideSeriesInfo>()
     .Setup(s => s.GetSeriesInfo(It.IsAny <Int32>()))
     .Returns(new Tuple <Series, List <Episode> >(series, new List <Episode>()));
 }
示例#52
0
 public IEnumerable <Series> Put([FromBody] Series Series)
 {
     SeriesRepo.Update(Series);
     return(SeriesRepo.GetAll());
 }
示例#53
0
 private static bool ShareProviderId(Series a, Series b)
 {
     return(string.Equals(a.PresentationUniqueKey, b.PresentationUniqueKey, StringComparison.Ordinal));
 }
        internal override string GenerarFiltrosColumnas()
        {
            var sb   = new StringBuilder();
            var flag = true;

            ValoresParametros.Clear();
            Condiciones.Clear();
            sb.Append(" p.empresa = '" + Empresa + "' ");

            if (Series?.Any() ?? false)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                foreach (var item in Series)
                {
                    ValoresParametros.Add(item, item);
                }

                sb.Append(" p.fkseries in ( " + string.Join(", ", Series.ToArray().Select(f => "@" + f)) + " ) ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.SeriesListado, string.Join(", ", Series.ToArray())));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Estado) && !Estado.Equals("0-"))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("estado", Estado);
                sb.Append(" p.fkestados=@estado ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.Estado, Estados?.First(f => f.CampoId == Estado).Descripcion ?? string.Empty));
                flag = true;
            }

            if (FechaDesde.HasValue)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fechadesde", FechaDesde.Value);
                sb.Append(" p.fechadocumento>=@fechadesde ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FechaDesde, FechaDesde));
                flag = true;
            }

            if (FechaHasta.HasValue)
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fechahasta", FechaHasta.Value);
                sb.Append(" p.fechadocumento<=@fechahasta ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FechaHasta, FechaHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("cuentadesde", CuentaDesde);
                sb.Append(" p.fkclientes>=@cuentadesde ");
                Condiciones.Add(string.Format("{0}: {1}", Rcuentas.CuentaDesde, CuentaDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(CuentaHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("cuentahasta", CuentaHasta);
                sb.Append(" p.fkclientes<=@cuentahasta ");
                Condiciones.Add(string.Format("{0}: {1}", Rcuentas.CuentaHasta, CuentaHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkarticulosDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkarticulosdesde", FkarticulosDesde);
                sb.Append(" pl.fkarticulos >= @fkarticulosdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FkarticulosDesde, FkarticulosDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkarticulosHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkarticuloshasta", FkarticulosHasta);
                sb.Append(" pl.fkarticulos <= @fkarticuloshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FkarticulosHasta, FkarticulosHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(Fkfamiliasmateriales))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }
                AppService = new ApplicationHelper(Context);
                ValoresParametros.Add("fkfamiliasmateriales", Fkfamiliasmateriales);
                sb.Append("  exists(select mm.* from materiales as mm where mm.id=Substring(pl.fkarticulos,3,3) and mm.fkfamiliamateriales=@fkfamiliasmateriales)  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FamiliaMateriales, AppService.GetListFamiliaMateriales().SingleOrDefault(f => f.Valor == Fkfamiliasmateriales).Descripcion));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkfamiliasDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkfamiliasdesde", FkfamiliasDesde);
                sb.Append(" Substring(pl.fkarticulos,0,3) >= @fkfamiliasdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FamiliaDesde, FkfamiliasDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkfamiliasHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkfamiliashasta", FkfamiliasHasta);
                sb.Append(" Substring(pl.fkarticulos,0,3) <= @fkfamiliashasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.FamiliaHasta, FkfamiliasHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkmaterialesDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkmaterialesdesde", FkmaterialesDesde);
                sb.Append(" Substring(pl.fkarticulos,3,3) >= @fkmaterialesdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.MaterialesDesde, FkmaterialesDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkmaterialesHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkmaterialeshasta", FkmaterialesHasta);
                sb.Append(" Substring(pl.fkarticulos,3,3) <= @fkmaterialeshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.MaterialesHasta, FkmaterialesHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkcaracteristicasDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkcaracteristicasdesde", FkcaracteristicasDesde);
                sb.Append(" Substring(pl.fkarticulos,6,2) >= @fkcaracteristicasdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.CaracteristicasDesde, FkcaracteristicasDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkcaracteristicasHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkcaracteristicashasta", FkcaracteristicasHasta);
                sb.Append(" Substring(pl.fkarticulos,6,2) <= @fkcaracteristicashasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.CaracteristicasHasta, FkcaracteristicasHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkgrosoresDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkgrosoresdesde", FkgrosoresDesde);
                sb.Append(" Substring(pl.fkarticulos,8,2) >= @fkgrosoresdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.GrosoresDesde, FkgrosoresDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkgrosoresHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkgrosoreshasta", FkgrosoresHasta);
                sb.Append(" Substring(pl.fkarticulos,8,2) <= @fkgrosoreshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.GrosoresHasta, FkgrosoresHasta));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkacabadosDesde))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkacabadosdesde", FkacabadosDesde);
                sb.Append(" Substring(pl.fkarticulos,10,2) >= @fkacabadosdesde  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.AcabadosDesde, FkacabadosDesde));
                flag = true;
            }

            if (!string.IsNullOrEmpty(FkacabadosHasta))
            {
                if (flag)
                {
                    sb.Append(" AND ");
                }

                ValoresParametros.Add("fkacabadoshasta", FkacabadosHasta);
                sb.Append(" Substring(pl.fkarticulos,10,2) <= @fkacabadoshasta  ");
                Condiciones.Add(string.Format("{0}: {1}", RFacturas.AcabadosHasta, FkacabadosHasta));
                flag = true;
            }



            return(sb.ToString());
        }
示例#55
0
        protected void monthASPxCombo_SelectedIndexChanged(object sender, EventArgs e)
        {
            hrASPxCombo.SelectedIndex  = 0;
            dayASPxCombo.SelectedIndex = 0;

            DataTable dt1 = VSWebBL.DashboardBL.DominoServerStatisticsDetailBLL.Ins.SetGraph("mm", "azphxdom1/RPRWyatt");
            DataTable dt2 = null;

            if (monthASPxCombo.SelectedIndex == 1)
            {
                dt2 = VSWebBL.DashboardBL.DominoServerStatisticsDetailBLL.Ins.SetGraphForMonthCombo("azphxdom1/RPRWyatt", "mm", monthASPxCombo.Value.ToString());
            }
            else if (monthASPxCombo.SelectedIndex == 2)
            {
                dt2 = VSWebBL.DashboardBL.DominoServerStatisticsDetailBLL.Ins.SetGraphForMonthCombo("azphxdom1/RPRWyatt", "mm", monthASPxCombo.Value.ToString());
            }
            else if (monthASPxCombo.SelectedIndex == 3)
            {
                dt2 = VSWebBL.DashboardBL.DominoServerStatisticsDetailBLL.Ins.SetGraphForMonthCombo("azphxdom1/RPRWyatt", "mm", monthASPxCombo.Value.ToString());
            }
            else if (monthASPxCombo.SelectedIndex == 4)
            {
                dt2 = VSWebBL.DashboardBL.DominoServerStatisticsDetailBLL.Ins.SetGraphForMonthCombo("azphxdom1/RPRWyatt", "mm", monthASPxCombo.Value.ToString());
            }
            else
            {
                dt2 = VSWebBL.DashboardBL.DominoServerStatisticsDetailBLL.Ins.SetGraphForMonthCombo("azphxdom1/RPRWyatt", "mm", monthASPxCombo.Value.ToString());
            }

            bool flag = true;

            Series series = null;

            while (flag)
            {
                if (series == null)
                {
                    series            = new Series("series1", ViewType.Line);
                    series.Visible    = true;
                    series.DataSource = dt1;

                    series.ArgumentDataMember = dt1.Columns["Date"].ToString();

                    ValueDataMemberCollection seriesValueDataMembers = (ValueDataMemberCollection)series.ValueDataMembers;
                    seriesValueDataMembers.AddRange(dt1.Columns["StatValue"].ToString());
                    series.CrosshairEnabled = DevExpress.Utils.DefaultBoolean.True;
                    series.View.Color       = Color.Blue;
                    dominoServerWebChart.Series.Add(series);
                    ((XYDiagram)dominoServerWebChart.Diagram).PaneLayoutDirection = PaneLayoutDirection.Horizontal;

                    XYDiagram seriesXY = (XYDiagram)dominoServerWebChart.Diagram;
                    seriesXY.AxisX.Title.Text    = "Time";
                    seriesXY.AxisX.Title.Visible = true;
                    seriesXY.AxisY.Title.Text    = "Performance";
                    seriesXY.AxisY.Title.Visible = true;

                    dominoServerWebChart.Legend.Visible = true;

                    // ((SplineSeriesView)series.View).LineTensionPercent = 100;
                    ((LineSeriesView)series.View).LineMarkerOptions.Size  = 4;
                    ((LineSeriesView)series.View).LineMarkerOptions.Color = Color.White;

                    //PointSeriesLabel label = (PointSeriesLabel)series.Label;
                    //label.LineLength = 12;
                    //label.LineVisible = true;
                    //label.ResolveOverlappingMode = ResolveOverlappingMode.JustifyAllAroundPoint;

                    AxisBase axis2 = ((XYDiagram)dominoServerWebChart.Diagram).AxisX;
                    //4/18/2014 NS commented out for VSPLUS-312
                    //axis2.DateTimeGridAlignment = DateTimeMeasurementUnit.Month;
                    axis2.GridSpacingAuto = false;
                    axis2.MinorCount      = 15;

                    //axis.GridSpacing = 12;
                    axis2.GridSpacing = 0.5;
                    axis2.Range.SideMarginsEnabled     = false;
                    axis2.GridLines.Visible            = true;
                    axis2.DateTimeOptions.Format       = DateTimeFormat.Custom;
                    axis2.DateTimeOptions.FormatString = "dd/MM HH:mm";

                    //((SplineSeriesView)series.View).Color = Color.Blue;

                    AxisBase axisy = ((XYDiagram)dominoServerWebChart.Diagram).AxisY;
                    axisy.Range.AlwaysShowZeroLevel = false;
                    axisy.Range.SideMarginsEnabled  = true;
                }
                else
                {
                    Series series1 = new Series("series2", ViewType.Line);
                    //Series series2 = new Series("s2", ViewType.Spline);
                    series1.Visible            = true;
                    series1.DataSource         = dt2;
                    series1.ArgumentDataMember = dt2.Columns["Date"].ToString();

                    ValueDataMemberCollection seriesValueDataMembers = (ValueDataMemberCollection)series1.ValueDataMembers;
                    seriesValueDataMembers.AddRange(dt2.Columns["StatValue"].ToString());
                    series1.CrosshairEnabled = DevExpress.Utils.DefaultBoolean.True;
                    series1.View.Color       = Color.SeaGreen;
                    dominoServerWebChart.Series.Add(series1);
                    ((XYDiagram)dominoServerWebChart.Diagram).PaneLayoutDirection = PaneLayoutDirection.Horizontal;

                    XYDiagram seriesXY = (XYDiagram)dominoServerWebChart.Diagram;
                    //seriesXY.AxisX.Title.Text = "Time";
                    //seriesXY.AxisX.Title.Visible = true;
                    seriesXY.AxisY.Title.Text    = "Performance";
                    seriesXY.AxisY.Title.Visible = true;

                    dominoServerWebChart.Legend.Visible = false;

                    //((SplineSeriesView)series1.View).LineTensionPercent = 100;
                    ((LineSeriesView)series1.View).LineMarkerOptions.Size  = 4;
                    ((LineSeriesView)series1.View).LineMarkerOptions.Color = Color.White;

                    // ((SplineSeriesView)series1.View).Color = Color.SeaGreen;
                    //PointSeriesLabel label = (PointSeriesLabel)series.Label;
                    //label.LineLength = 12;
                    //label.LineVisible = true;
                    //label.ResolveOverlappingMode = ResolveOverlappingMode.JustifyAllAroundPoint;

                    AxisBase axis2 = ((XYDiagram)dominoServerWebChart.Diagram).AxisX;
                    //4/18/2014 NS commented out for VSPLUS-312
                    //axis2.DateTimeGridAlignment = DateTimeMeasurementUnit.Month;
                    axis2.GridSpacingAuto = false;
                    axis2.MinorCount      = 15;
                    //axis.GridSpacing = 12;
                    axis2.GridSpacing = 0.5;
                    axis2.Range.SideMarginsEnabled     = false;
                    axis2.GridLines.Visible            = true;
                    axis2.DateTimeOptions.Format       = DateTimeFormat.Custom;
                    axis2.DateTimeOptions.FormatString = "dd/MM HH:mm";

                    AxisBase axisy = ((XYDiagram)dominoServerWebChart.Diagram).AxisY;
                    axisy.Range.AlwaysShowZeroLevel = false;
                    axisy.Range.SideMarginsEnabled  = true;

                    //((SplineSeriesView)series.View).Color = Color.;

                    flag = false;
                }
            }
        }
示例#56
0
        private void AddUndefinedChannels(MeterDataSet meterDataSet)
        {
            List<DataSeries> undefinedDataSeries = meterDataSet.DataSeries
                .Concat(meterDataSet.Digitals)
                .Where(dataSeries => (object)dataSeries.SeriesInfo.Channel.Line == null)
                .ToList();

            if (undefinedDataSeries.Count <= 0)
                return;

            Meter meter = meterDataSet.Meter;

            if (meter.MeterLines.Count == 0)
            {
                Log.Warn($"Unable to automatically add channels to meter {meterDataSet.Meter.Name} because there are no lines associated with that meter.");
                return;
            }

            if (meter.MeterLines.Count > 1)
            {
                Log.Warn($"Unable to automatically add channels to meter {meterDataSet.Meter.Name} because there are too many lines associated with that meter.");
                return;
            }

            Line line = meter.MeterLines
                .Select(meterLine => meterLine.Line)
                .Single();

            foreach (DataSeries series in undefinedDataSeries)
                series.SeriesInfo.Channel.LineID = line.ID;

            using (AdoDataConnection connection = meterDataSet.CreateDbConnection())
            {
                TableOperations<MeasurementType> measurementTypeTable = new TableOperations<MeasurementType>(connection);
                TableOperations<MeasurementCharacteristic> measurementCharacteristicTable = new TableOperations<MeasurementCharacteristic>(connection);
                TableOperations<Phase> phaseTable = new TableOperations<Phase>(connection);
                TableOperations<SeriesType> seriesTypeTable = new TableOperations<SeriesType>(connection);

                Dictionary<string, MeasurementType> measurementTypeLookup = undefinedDataSeries
                    .Select(dataSeries => dataSeries.SeriesInfo.Channel.MeasurementType)
                    .DistinctBy(measurementType => measurementType.Name)
                    .Select(measurementType => measurementTypeTable.GetOrAdd(measurementType.Name, measurementType.Description))
                    .ToDictionary(measurementType => measurementType.Name);

                Dictionary<string, MeasurementCharacteristic> measurementCharacteristicLookup = undefinedDataSeries
                    .Select(dataSeries => dataSeries.SeriesInfo.Channel.MeasurementCharacteristic)
                    .DistinctBy(measurementCharacteristic => measurementCharacteristic.Name)
                    .Select(measurementCharacteristic => measurementCharacteristicTable.GetOrAdd(measurementCharacteristic.Name, measurementCharacteristic.Description))
                    .ToDictionary(measurementCharacteristic => measurementCharacteristic.Name);

                Dictionary<string, Phase> phaseLookup = undefinedDataSeries
                    .Select(dataSeries => dataSeries.SeriesInfo.Channel.Phase)
                    .DistinctBy(phase => phase.Name)
                    .Select(phase => phaseTable.GetOrAdd(phase.Name, phase.Description))
                    .ToDictionary(phase => phase.Name);

                Dictionary<string, SeriesType> seriesTypeLookup = undefinedDataSeries
                    .Select(dataSeries => dataSeries.SeriesInfo.SeriesType)
                    .DistinctBy(seriesType => seriesType.Name)
                    .Select(seriesType => seriesTypeTable.GetOrAdd(seriesType.Name, seriesType.Description))
                    .ToDictionary(seriesType => seriesType.Name);

                Dictionary<ChannelKey, Channel> channelLookup = meter.Channels
                    .GroupBy(channel => new ChannelKey(channel))
                    .ToDictionary(grouping =>
                    {
                        if (grouping.Count() > 1)
                            Log.Warn($"Detected duplicate channel key: {grouping.First().ID}");

                        return grouping.Key;
                    }, grouping => grouping.First());

                List<Channel> undefinedChannels = undefinedDataSeries
                    .Select(dataSeries => dataSeries.SeriesInfo.Channel)
                    .GroupBy(channel => new ChannelKey(channel))
                    .Where(grouping => !channelLookup.ContainsKey(grouping.Key))
                    .Select(grouping => grouping.First())
                    .ToList();

                TableOperations<Channel> channelTable = new TableOperations<Channel>(connection);

                // Add all undefined channels to the database
                foreach (Channel channel in undefinedChannels)
                {
                    string measurementTypeName = channel.MeasurementType.Name;
                    string measurementCharacteristicName = channel.MeasurementCharacteristic.Name;
                    string phaseName = channel.Phase.Name;

                    channel.MeterID = meter.ID;
                    channel.LineID = line.ID;
                    channel.MeasurementTypeID = measurementTypeLookup[measurementTypeName].ID;
                    channel.MeasurementCharacteristicID = measurementCharacteristicLookup[measurementCharacteristicName].ID;
                    channel.PhaseID = phaseLookup[phaseName].ID;
                    channel.Enabled = true;

                    // If the per-unit value was not specified in the input file,
                    // we can obtain the per-unit value from the line configuration
                    // if the channel happens to be an instantaneous or RMS voltage
                    if (!channel.PerUnitValue.HasValue)
                    {
                        if (IsVoltage(channel))
                        {
                            if (IsLineToNeutral(channel))
                                channel.PerUnitValue = (line.VoltageKV * 1000.0D) / Sqrt3;
                            else if (IsLineToLine(channel))
                                channel.PerUnitValue = line.VoltageKV * 1000.0D;
                        }
                    }

                    channelTable.AddNewRecord(channel);
                }

                if (undefinedChannels.Count > 0)
                {
                    // Refresh the channel lookup to
                    // include all the new channels
                    meter.Channels = null;

                    channelLookup = meter.Channels
                        .GroupBy(channel => new ChannelKey(channel))
                        .ToDictionary(grouping => grouping.Key, grouping => grouping.First());
                }

                Dictionary<SeriesKey, Series> seriesLookup = meter.Channels
                    .SelectMany(channel => channel.Series)
                    .Where(series => series.SourceIndexes == "")
                    .GroupBy(series => new SeriesKey(series))
                    .ToDictionary(grouping =>
                    {
                        if (grouping.Count() > 1)
                            Log.Warn($"Detected duplicate series key: {grouping.First().ID}");

                        return grouping.Key;
                    }, grouping => grouping.First());

                List<Series> undefinedSeries = undefinedDataSeries
                    .SelectMany(dataSeries => dataSeries.SeriesInfo.Channel.Series)
                    .GroupBy(series => new SeriesKey(series))
                    .Where(grouping => !seriesLookup.ContainsKey(grouping.Key))
                    .Select(grouping => grouping.First())
                    .ToList();

                TableOperations<Series> seriesTable = new TableOperations<Series>(connection);

                // Add all undefined series objects to the database
                foreach (Series series in undefinedSeries)
                {
                    ChannelKey channelKey = new ChannelKey(series.Channel);
                    string seriesTypeName = series.SeriesType.Name;

                    series.ChannelID = channelLookup[channelKey].ID;
                    series.SeriesTypeID = seriesTypeLookup[seriesTypeName].ID;
                    series.SourceIndexes = "";

                    seriesTable.AddNewRecord(series);
                }

                if (undefinedSeries.Count > 0)
                {
                    // Refresh the series lookup to
                    // include all the new series
                    foreach (Channel channel in meter.Channels)
                        channel.Series = null;

                    seriesLookup = meter.Channels
                        .SelectMany(channel => channel.Series)
                        .GroupBy(series => new SeriesKey(series))
                        .ToDictionary(grouping => grouping.Key, grouping => grouping.First());
                }

                // Update all undefined data series to reference the new database objects
                foreach (DataSeries dataSeries in undefinedDataSeries)
                {
                    SeriesKey seriesKey = new SeriesKey(dataSeries.SeriesInfo);
                    Series series = seriesLookup[seriesKey];
                    dataSeries.SeriesInfo = series;
                }
            }
        }
示例#57
0
 public void Add(Series series)
 {
     _context.Series.Add(series);
 }
示例#58
0
 public void Update(Series series)
 {
     _context.Entry(series).State = EntityState.Modified;
 }
 public void AddSeries(Series series)
 {
     this.seriesEvents.Add(series.Id,
                           new TeamEvents(series.Id, this.teamId));
 }
        private async void ctrlDashboard_Load(Object sender, EventArgs e)
        {
            if (DateTime.Now.Month < 10)
            {
                dataAtual = "0" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString();
            }
            else
            {
                dataAtual = DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString();
            }
            string path = AppDomain.CurrentDomain.BaseDirectory + @"pro-vantagens-firebase-adminsdk-5cf5q-82ec44750b.json";

            Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", path);

            FirestoreDb db = FirestoreDb.Create("pro-vantagens");

            Query         queryUser      = db.Collection("users");
            QuerySnapshot usersSnapshots = await queryUser.GetSnapshotAsync();

            foreach (DocumentSnapshot userDocument in usersSnapshots)
            {
                Clients clients = userDocument.ConvertTo <Clients>();
                if (userDocument.Exists)
                {
                    clientsTotal = clientsTotal + 1;
                    if (clients.plan != null)
                    {
                        clientsOn = clientsOn + 1;
                    }
                }

                Query         Query     = db.Collection("users").Document(userDocument.Id).Collection("invoices");
                QuerySnapshot snapshots = await Query.GetSnapshotAsync();

                foreach (DocumentSnapshot documentSnapshot in snapshots)
                {
                    if (documentSnapshot.Exists)
                    {
                        Invoices invoices = documentSnapshot.ConvertTo <Invoices>();
                        if (documentSnapshot.Id == dataAtual)
                        {
                            if (invoices.status == "Ok")
                            {
                                invoiceOk = invoiceOk + 1;
                            }
                            if (invoices.status == "Pendente")
                            {
                                invoicePendente = invoicePendente + 1;
                            }
                            if (invoices.status == "Vencido")
                            {
                                invoiceVencida = invoiceVencida + 1;
                            }
                        }
                        else
                        {
                            if (invoices.status == "Vencido")
                            {
                                invoiceVencidaOld = invoiceVencidaOld + 1;
                            }
                        }
                    }
                }

                Query         queryPay = db.Collection("users").Document(userDocument.Id).Collection("payments");
                QuerySnapshot paySnap  = await queryPay.GetSnapshotAsync();

                String documentName;

                foreach (DocumentSnapshot paySnapshot in paySnap)
                {
                    Payments payments = paySnapshot.ConvertTo <Payments>();

                    if (payments.status == "Ok")
                    {
                        documentName = (paySnapshot.Id.Split('-')[1] + "-" + paySnapshot.Id.Split('-')[2]);
                        if (documentName == dataAtual)
                        {
                            recebidoMes = recebidoMes + Convert.ToDouble(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "01-" + DateTime.Now.Year.ToString())
                        {
                            janNow = janNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "02-" + DateTime.Now.Year.ToString())
                        {
                            fevNow = fevNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "03-" + DateTime.Now.Year.ToString())
                        {
                            marNow = marNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "04-" + DateTime.Now.Year.ToString())
                        {
                            abrNow = abrNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "05-" + DateTime.Now.Year.ToString())
                        {
                            maiNow = maiNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "06-" + DateTime.Now.Year.ToString())
                        {
                            junNow = junNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "07-" + DateTime.Now.Year.ToString())
                        {
                            julNow = julNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "08-" + DateTime.Now.Year.ToString())
                        {
                            agoNow = agoNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "09-" + DateTime.Now.Year.ToString())
                        {
                            setNow = setNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "10-" + DateTime.Now.Year.ToString())
                        {
                            outNow = outNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "11-" + DateTime.Now.Year.ToString())
                        {
                            novNow = novNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "12-" + DateTime.Now.Year.ToString())
                        {
                            dezNow = dezNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "01-" + DateTime.Now.Year.ToString())
                        {
                            janNow = janNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "02-" + DateTime.Now.Year.ToString())
                        {
                            fevNow = fevNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "03-" + DateTime.Now.Year.ToString())
                        {
                            marNow = marNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "04-" + DateTime.Now.Year.ToString())
                        {
                            abrNow = abrNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "05-" + DateTime.Now.Year.ToString())
                        {
                            maiNow = maiNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "06-" + DateTime.Now.Year.ToString())
                        {
                            junNow = junNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "07-" + DateTime.Now.Year.ToString())
                        {
                            julNow = julNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "08-" + DateTime.Now.Year.ToString())
                        {
                            agoNow = agoNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "09-" + DateTime.Now.Year.ToString())
                        {
                            setNow = setNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "10-" + DateTime.Now.Year.ToString())
                        {
                            outNow = outNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "11-" + DateTime.Now.Year.ToString())
                        {
                            novNow = novNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "12-" + DateTime.Now.Year.ToString())
                        {
                            dezNow = dezNow + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }

                        //Ano anterior

                        if (documentName == "01-" + (DateTime.Now.Year - 1).ToString())
                        {
                            janOld = janOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "02-" + (DateTime.Now.Year - 1).ToString())
                        {
                            fevOld = fevOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "03-" + (DateTime.Now.Year - 1).ToString())
                        {
                            marOld = marOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "04-" + (DateTime.Now.Year - 1).ToString())
                        {
                            abrOld = abrOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "05-" + (DateTime.Now.Year - 1).ToString())
                        {
                            maiOld = maiOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "06-" + (DateTime.Now.Year - 1).ToString())
                        {
                            junOld = junOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "07-" + (DateTime.Now.Year - 1).ToString())
                        {
                            julOld = julOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "08-" + (DateTime.Now.Year - 1).ToString())
                        {
                            agoOld = agoOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "09-" + (DateTime.Now.Year - 1).ToString())
                        {
                            setOld = setOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "10-" + (DateTime.Now.Year - 1).ToString())
                        {
                            outOld = outOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "11-" + (DateTime.Now.Year - 1).ToString())
                        {
                            novOld = novOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                        if (documentName == "12-" + (DateTime.Now.Year - 1).ToString())
                        {
                            dezOld = dezOld + double.Parse(payments.value.Replace("R$: ", ""), CultureInfo.InvariantCulture);
                        }
                    }
                    if (payments.status == "Estornado")
                    {
                    }
                }
            }



            ///////////////////////////////////////Adicionar dados a tela\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
            //Assinaturas
            lbClientsTotal.Text = clientsTotal.ToString();
            lbClientsOn.Text    = clientsOn.ToString();

            //Cobrança
            lbPayOk.Text       = invoiceOk.ToString();
            lbNoPrazo.Text     = invoicePendente.ToString();
            lbVencidas.Text    = invoiceVencida.ToString();
            lbVencidasOld.Text = invoiceVencidaOld.ToString();

            //Valor recebido no mês
            lbRecebidoMes.Text = "R$ " + recebidoMes.ToString();
            //Grafico ano atual
            this.graficPaymentsNow.Palette = ChartColorPalette.SeaGreen;
            graficPaymentsNow.Series.Clear();
            Series series = this.graficPaymentsNow.Series.Add("Ano atual");

            series.ChartType       = SeriesChartType.RangeColumn;
            series.IsXValueIndexed = true;
            for (int i = 0; i < months.Length; i++)
            {
                if (months[i] == "Janeiro")
                {
                    series.Points.AddXY(months[i], janNow);
                }
                if (months[i] == "Fevereiro")
                {
                    series.Points.AddXY(months[i], fevNow);
                }
                if (months[i] == "Março")
                {
                    series.Points.AddXY(months[i], marNow);
                }
                if (months[i] == "Abril")
                {
                    series.Points.AddXY(months[i], abrNow);
                }
                if (months[i] == "Maio")
                {
                    series.Points.AddXY(months[i], maiNow);
                }
                if (months[i] == "Junho")
                {
                    series.Points.AddXY(months[i], junNow);
                }
                if (months[i] == "Julho")
                {
                    series.Points.AddXY(months[i], julNow);
                }
                if (months[i] == "Agosto")
                {
                    series.Points.AddXY(months[i], agoNow);
                }
                if (months[i] == "Setembro")
                {
                    series.Points.AddXY(months[i], setNow);
                }
                if (months[i] == "Outubro")
                {
                    series.Points.AddXY(months[i], outNow);
                }
                if (months[i] == "Novembro")
                {
                    series.Points.AddXY(months[i], novNow);
                }
                if (months[i] == "Dezembro")
                {
                    series.Points.AddXY(months[i], dezNow);
                }
            }

            //Grafico ano anterior
            this.graficPaymentsOld.Palette = ChartColorPalette.SeaGreen;
            graficPaymentsOld.Series.Clear();
            Series paymentOldSerie = this.graficPaymentsOld.Series.Add("Ano anterior");

            paymentOldSerie.ChartType       = SeriesChartType.RangeColumn;
            paymentOldSerie.IsXValueIndexed = true;

            for (int i = 0; i < months.Length; i++)
            {
                if (months[i] == "Janeiro")
                {
                    paymentOldSerie.Points.AddXY(months[i], janOld);
                }
                if (months[i] == "Fevereiro")
                {
                    paymentOldSerie.Points.AddXY(months[i], fevOld);
                }
                if (months[i] == "Março")
                {
                    paymentOldSerie.Points.AddXY(months[i], marOld);
                }
                if (months[i] == "Abril")
                {
                    paymentOldSerie.Points.AddXY(months[i], abrOld);
                }
                if (months[i] == "Maio")
                {
                    paymentOldSerie.Points.AddXY(months[i], maiOld);
                }
                if (months[i] == "Junho")
                {
                    paymentOldSerie.Points.AddXY(months[i], junOld);
                }
                if (months[i] == "Julho")
                {
                    paymentOldSerie.Points.AddXY(months[i], julOld);
                }
                if (months[i] == "Agosto")
                {
                    paymentOldSerie.Points.AddXY(months[i], agoOld);
                }
                if (months[i] == "Setembro")
                {
                    paymentOldSerie.Points.AddXY(months[i], setOld);
                }
                if (months[i] == "Outubro")
                {
                    paymentOldSerie.Points.AddXY(months[i], outOld);
                }
                if (months[i] == "Novembro")
                {
                    paymentOldSerie.Points.AddXY(months[i], novOld);
                }
                if (months[i] == "Dezembro")
                {
                    paymentOldSerie.Points.AddXY(months[i], dezOld);
                }
            }

            //Grafico assinaturas
            this.graficClients.Palette = ChartColorPalette.SeaGreen;
            graficClients.Series.Clear();
            Series clientSerie = this.graficClients.Series.Add("Clientes");

            clientSerie.ChartType       = SeriesChartType.Pie;
            clientSerie.IsXValueIndexed = true;

            for (int i = 0; i < clients.Length; i++)
            {
                if (clients[i] == "Ativos")
                {
                    clientSerie.Points.AddXY("Ativos", clientsOn);
                }
                if (clients[i] == "Inativos")
                {
                    clientSerie.Points.AddXY("Inativos", clientsTotal - clientsOn);
                }
            }
        }