private void getData_Click(object sender, EventArgs ea)
    {
      gradesChart.Series.Clear();
      output.Write(1);
      var grades = new System.Windows.Forms.DataVisualization.Charting.Series
      {
        Name = "Grade",
        Color = System.Drawing.Color.CornflowerBlue,
        IsVisibleInLegend = true,
        IsXValueIndexed = true,
        ChartType = SeriesChartType.Bar,
        XValueType = ChartValueType.String,
        YValueType = ChartValueType.Double
      };

      gradesChart.Series.Add(grades);
      var numEntries = input.ReadInt32();
      for (int i = 0; i < numEntries; i++)
      {
        var name = input.ReadString();
        var grade = input.ReadDouble();
        var point = new DataPoint();
        point.SetValueXY(name, new object[] { grade + 1.0 });
        grades.Points.Add(point);
      }

    }
Beispiel #2
0
        public System.Windows.Forms.DataVisualization.Charting.Chart GetChart(System.Windows.Forms.DataVisualization.Charting.Chart cc)
        {
            cc.Series.Clear();
            cc.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Days;

            Series s = new Series();

            s.ChartType   = SeriesChartType.Line;
            s.MarkerStyle = MarkerStyle.Circle;

            foreach (var d in Data)
            {
                DateTime current = d.Date.Date;
                int      i       = 0;
                foreach (Datum h in d.hourly.data)
                {
                    //DateTime hour = current.Add(new TimeSpan(i, 0, 0));
                    DateTime hour = UnixTimestampToDateTime(h.time);
                    hour = TimeZone.CurrentTimeZone.ToLocalTime(hour);

                    System.Windows.Forms.DataVisualization.Charting.DataPoint dp = new System.Windows.Forms.DataVisualization.Charting.DataPoint();
                    string dir = DegreesToCardinalDetailed(h.windBearing);
                    dp.ToolTip = dir + "\n" + hour.ToShortDateString() + "\n" + hour.ToShortTimeString();
                    dp.SetValueXY(hour, h.windSpeed);
                    s.Points.Add(dp);
                }
            }
            cc.Series.Add(s);
            return(cc);
        }
        void M_Tick(object sender, EventArgs e)
        {
            var DocStatus = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;

                DataPoint queryPoint = new DataPoint();
                queryPoint.SetValueXY(DateTime.Now.ToString(), DocStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("query").Value);
                MonitorGrap.Series[0].Points.Add(queryPoint);

                DataPoint insertPoint = new DataPoint();
                insertPoint.SetValueXY(DateTime.Now.ToString(), DocStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("insert").Value);
                MonitorGrap.Series[1].Points.Add(insertPoint);
        }
Beispiel #4
0
        public void DrawHistogram(Chart chart)
        {
            chart.Series["Intensity"].Points.Clear();

            for (int i = 0; i < this.intensities.Length; i++)
            {
                DataPoint dataPoint = new DataPoint();

                dataPoint.SetValueXY(i, this.intensities[i]);

                chart.Series["Intensity"].Points.Add(dataPoint);
            }
        }
        private void M_Tick(object sender, EventArgs e)
        {
            var docStatus =
                CommandHelper.ExecuteMongoSvrCommand(CommandHelper.ServerStatusCommand,
                    RuntimeMongoDbContext.GetCurrentServer()).Response;

            var queryPoint = new DataPoint();
            queryPoint.SetValueXY(DateTime.Now.ToString(CultureInfo.InvariantCulture),
                docStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("query").Value);
            MonitorGrap.Series[0].Points.Add(queryPoint);

            var insertPoint = new DataPoint();
            insertPoint.SetValueXY(DateTime.Now.ToString(CultureInfo.InvariantCulture),
                docStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("insert").Value);
            MonitorGrap.Series[1].Points.Add(insertPoint);
        }
Beispiel #6
0
        public void CreateHisto(Bitmap image, Chart chart)
        {
            for(int x = 0; x < image.Width; ++x)
            {
                for(int y = 0; y < image.Height; ++y)
                {
                    int brightness = image.GetPixel(x, y).R;

                    ++colors[brightness];
                }
            }

            chart.Series["Brightness"].Points.Clear();

            for (int x = 0; x < colors.Length; ++x)
            {
                DataPoint dp = new DataPoint();
                dp.SetValueXY(x, colors[x]);

                chart.Series["Brightness"].Points.Add(dp);
            }
        }
        /// <summary>
        /// Maj chart suivant le choix
        /// </summary>
        /// <param name="type"></param>
        protected void updateChart(string type)
        {
            ///// CHart
            // http://stackoverflow.com/questions/20606838/view-val-label-on-pie-chart-and-not-inside-the-series-when-slice-selected-tru

            //this.statChart.Series[0].Points.AddXY("2", "40");

            //this.statChart.ChartAreas[0].AxisX.LabelStyle.Format = "C";

            this.statChart.AntiAliasing = AntiAliasingStyles.All;
            this.statChart.Series[0].Points.Clear();
            this.statChart.Series[0].IsVisibleInLegend = true;
            this.statChart.Series[0].SmartLabelStyle.Enabled = false;

            var pieData = new List<KeyValuePair<string, long>>();
            switch (type)
            {
                case "1":
                    pieData = this.Db.GetFileXXXByExtension("size");
                    this.statChart.Series[0].ChartType = SeriesChartType.Pie;
                    break;
                case "2":
                    pieData = this.Db.GetFileXXXByType("size");
                    this.statChart.Series[0].ChartType = SeriesChartType.Pie;
                    break;
                case "3":
                    pieData = this.Db.GetFileXXXByExtension("count");
                    this.statChart.Series[0].ChartType = SeriesChartType.Pie;
                    break;
                case "4":
                    pieData = this.Db.GetFileXXXByType("count");
                    this.statChart.Series[0].ChartType = SeriesChartType.Pie;
                    break;
                case "5":
                    pieData = this.Db.GetFileXXXByInterval("count");
                    this.statChart.Series[0].ChartType = SeriesChartType.Column;
                    this.statChart.Series[0].IsVisibleInLegend = false;
                    break;
            }

            // calcul total pour avoir %
            double total = 0;
            foreach (KeyValuePair<string, long> pair in pieData)
            {
                total += pair.Value;
            }

            foreach (KeyValuePair<string, long> pair in pieData)
            {
                double avg = long.Parse(pair.Value.ToString()) * 100 / total;

                // Data arrays.
                DataPoint point = new DataPoint();
                point.SetValueXY(pair.Key, pair.Value);

                point.LegendText = pair.Key.ToString(); // "#VAL";

                //point.LabelBackColor = Color.Bisque;
                //point.LabelBorderColor = Color.Black;

                point.Font = new Font("Calibri Light", 8);
                if (avg >= 5)
                {
                    point.Label = pair.Key.ToString() + "\n" + "(" + Math.Round(avg).ToString() + "%)";
                    point.CustomProperties = "PieLabelStyle = Inside, Exploded = False";
                }
                else
                {
                    point.CustomProperties = "PieLabelStyle = Disabled, Exploded = True";
                }

                if (type == "1" || type == "2")
                {
                    point.ToolTip = string.Format("{0}, {1} ({2}%)", pair.Key, pair.Value.ToFileSize(), Math.Round(avg, 2));
                }
                else if (type == "5")
                {
                    point.LabelAngle = 90;
                    point.Label = pair.Key.ToString();
                    point.ToolTip = string.Format("{0}", pair.Value.ToString(), Math.Round(avg, 2));
                    point.CustomProperties = "PieLabelStyle = Inside, Exploded = True";
                    point.LabelAngle = -90;
                }
                else
                {
                    point.ToolTip = string.Format("{0}, {1} ({2}%)", pair.Key.ToString(), pair.Value.ToString(), Math.Round(avg, 2));
                }

                this.statChart.Series[0].Points.Add(point);

            }
        }
Beispiel #8
0
        public void Run()
        {
            this.SliderForMarkerSize.trackBar.Value = this.MarkerSize;
            this.SliderForMarkerSize.numericUpDown.Value = this.MarkerSize;

            this.SliderForLineWidth.trackBar.Value = this.LineWidth;
            this.SliderForLineWidth.numericUpDown.Value = this.LineWidth;

            this.SliderForOpacity.numericUpDown.Maximum = this.SliderForOpacity.trackBar.Maximum = 255;
            this.SliderForOpacity.trackBar.Value = this.Opacity;
            this.SliderForOpacity.numericUpDown.Value = this.Opacity;

            if ((InputSimpleData==null)||((X_AxisValues != null) && (X_AxisValues.Count != InputSimpleData[0].Count))) return;
            if ((X_AxisValues != null) && (X_AxisValues.Min() <= 0) && (IsLogAxis)) return;

            #region multiple readouts
            if (ListCurves.Count > 0)
            {
                //for (int IdxSimpleReadoutCurve = 0; IdxSimpleReadoutCurve < input.Count; IdxSimpleReadoutCurve++)

                foreach (cCurveForGraph item in ListCurves)
                {
                    if (item == null) continue;
                    Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(item.Title);

                    //NewSerie.ChartType = SeriesChartType.ErrorBar;
                    NewSerie.ChartType = SeriesChartType.Point;

                //    NewSerie.ChartType = SeriesChartType.Point;

                    //NewSerie.ChartType = SeriesChartType.SplineRange;
                    NewSerie.ShadowOffset = 0;
                    //NewSerie.ShadowColor = Color.Transparent;

                    #region loop over the multireadouts curves
                    for (int j = 0; j < item.ListPtValues.Count; j++)
                    {
                        //this.chartForPoints.Series[0].Points[j].MarkerColor = Color.FromArgb(128, GlobalInfo.ListCellularPhenotypes[(int)MachineLearning.Classes[j]].ColourForDisplay);

                        cExtendedList ListValues = new cExtendedList();
                        for (int IdxValue = 1; IdxValue < item.ListPtValues[j].Count; IdxValue++)
                        {
                            ListValues.Add(item.ListPtValues[j][IdxValue]);
                        }

                        double[] Values = new double[2];

                        double Mean = ListValues.Mean();
                        double Std = ListValues.Std();

                        if (NewSerie.ChartType == SeriesChartType.ErrorBar)
                        {
                            Values = new double[3];
                            Values[0] = Mean;
                            Values[1] = Mean - Std;
                            Values[2] = Mean + Std;
                            DataPoint DP = new DataPoint();
                            DP.XValue = item.ListPtValues[j][0];
                            DP.YValues = Values;
                            DP.Color = Color.AliceBlue;
                            NewSerie.Points.Add(DP);
                        }
                        else if (NewSerie.ChartType == SeriesChartType.SplineRange)
                        {
                            Values[0] = Mean - Std;
                            Values[1] = Mean + Std;
                            DataPoint DP = new DataPoint();
                            DP.XValue = item.ListPtValues[j][0];
                            DP.YValues = Values;
                            DP.Color = Color.FromArgb(200, Color.Tomato);
                           // DP.MarkerSize = 10;
                            NewSerie.Points.Add(DP);
                        }
                        else
                        {
                           // Values = ListValues.ToArray();
                            for (int i = 0; i < ListValues.Count; i++)
                            {
                                 DataPoint DP = new DataPoint();
                                 DP.SetValueXY(item.ListPtValues[j][0], ListValues[i]);
                                 DP.Color = Color.FromArgb(190, Color.Tomato);
                                 DP.BorderColor = Color.Black;

                                 DP.BorderWidth = 1;
                                 DP.MarkerSize = 8;
                                 DP.MarkerStyle = MarkerStyle.Circle;
                                 NewSerie.Points.Add(DP);
                            }

                        }

                       // DP.Tag = DataSerie.Tag;
                        ////   Value[0] = item.ListPtValues[j];
                        //for (int IdxValue = 1; IdxValue < item.ListPtValues[j].Count; IdxValue++)
                        //{
                        //    ListValues.Add(item.ListPtValues[j][IdxValue]);
                        //}

                        //double[] Values = new double[2];
                        ////Values[0] = ListValues.Mean();
                        //double Mean = ListValues.Mean();
                        //double Std = ListValues.Std();
                        //Values[0] = Mean - Std;
                        //Values[1] = Mean + Std;

                        //DP.YValues = Values;

                        //if (IsBorder)
                        //{
                        //    DP.MarkerBorderColor = Color.Black;
                        //    DP.MarkerBorderWidth = 1;
                        //}

                        //if ((ArraySeriesInfo != null) && (ArraySeriesInfo[IdxSimpleReadoutCurve] != null))
                        //{
                        //    DP.Color = Color.FromArgb(this.Opacity, ArraySeriesInfo[IdxSimpleReadoutCurve].color);
                        //    NewSerie.Tag = ArraySeriesInfo[IdxSimpleReadoutCurve];
                        //    DP.MarkerStyle = ArraySeriesInfo[IdxSimpleReadoutCurve].markerStyle;
                        //    DP.MarkerSize = this.MarkerSize;
                        //}
                        //else
                       // {
                            //DP.MarkerStyle = MarkerStyle.Diamond;
                            // DP.MarkerSize = 4;
                       // }

                        // DP.BorderWidth = 2;

                        //if (item.ListPtValues[0].ListTags != null)
                        //{
                        //    if (j >= item.ListPtValues[0].ListTags.Count) continue;
                        //    DP.Tag = item.ListPtValues[0].ListTags[j];

                        //    if (DP.Tag.GetType() == typeof(cWell))
                        //    {
                        //        DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //        // DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];
                        //    }
                        //    if (DP.Tag.GetType() == typeof(cDescriptorsType))
                        //    {
                        //        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //        //  DP.ToolTip = ((cDescriptorsType)(DP.Tag)).GetShortInfo() + Value[0];
                        //        DP.AxisLabel = ((cDescriptorsType)(DP.Tag)).GetName();
                        //        base.CurrentChartArea.AxisX.Interval = 1;

                        //    }
                        //    if (DP.Tag.GetType() == typeof(cPlate))
                        //    {
                        //        // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                        //        //  DP.ToolTip = ((cPlate)(DP.Tag)).Name + " : " + Value[0];
                        //        DP.AxisLabel = ((cPlate)(DP.Tag)).Name;
                        //        base.CurrentChartArea.AxisX.Interval = 1;

                        //    }

                        //}
                        //NewSerie.Points.Add(DP);
                    }
                    #endregion

                    base.CurrentSeries.Add(NewSerie);
                }
            }

            if (base.ListInput != null)
            {
                foreach (cExtendedTable DataSerie in base.ListInput)
                {
                    Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series("ComplexD_ataTable"+DataSerie.Name);
                    NewSerie.Tag = DataSerie.Tag;

                    //NewSerie.ChartType = SeriesChartType.SplineRange;
                    NewSerie.ChartType = SeriesChartType.ErrorBar;

                    for (int IdxPt = 0; IdxPt < DataSerie.Count; IdxPt++)
                    {
                        DataPoint DP = new DataPoint();
                        DP.XValue = DataSerie[IdxPt][0];

                        cExtendedList ListValues = new cExtendedList();
                        for (int i = 1; i < DataSerie[IdxPt].Count; i++)
                        {
                            ListValues.Add(DataSerie[IdxPt][i]);
                        }

                        if (ListValues.Count == 0) continue;
                        double[] Values = new double[2];

                        double Mean = ListValues.Mean();
                        double Std = ListValues.Std();
                        if (ListValues.Count == 1)
                            Std = 0;

                        if (NewSerie.ChartType == SeriesChartType.ErrorBar)
                        {
                            Values = new double[3];
                            Values[0] = Mean;
                            Values[1] = Mean - Std;
                            Values[2] = Mean + Std;
                        }
                        else
                        {
                            Values[0] = Mean - Std;
                            Values[1] = Mean + Std;
                        }
                        DP.YValues = Values;
                        DP.Tag = DataSerie.Tag;

                        DP.ToolTip = "Mean: " + Mean + "\nStdev: " + Std;

                        if (DP.Tag.GetType() == typeof(cWellClassType))
                        {
                            DP.Color = Color.FromArgb(200, ((cWellClassType)(DP.Tag)).ColourForDisplay);
                        }
                        //if (DP.Tag.GetType() == typeof(cWell))
                        //{
                        //    DP.Color = ((cWell)(DP.Tag)).GetClassColor();

                        //}
                       // DP.Color = Color.FromArgb(200, Color.Tomato);

                        NewSerie.Points.Add(DP);
                    }

                    base.CurrentSeries.Add(NewSerie);

                }

            }

            #endregion

            #region simple readout curves
            if (InputSimpleData != null)
            {
                cLUTProcess LUTProcess = new cLUTProcess(cGlobalInfo.GraphsLUT);

                for (int IdxSimpleReadoutCurve = 0; IdxSimpleReadoutCurve < InputSimpleData.Count; IdxSimpleReadoutCurve++)
                {
                    Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(base.InputSimpleData[IdxSimpleReadoutCurve].Name);
                    NewSerie.Tag = base.InputSimpleData[IdxSimpleReadoutCurve].Tag;

                    if (ISPoint)
                        NewSerie.ChartType = SeriesChartType.Point;
                    if (ISFastPoint)
                        NewSerie.ChartType = SeriesChartType.FastPoint;
                    if (IsLine)
                        NewSerie.ChartType = SeriesChartType.Line;
                    if (IsBar)
                        NewSerie.ChartType = SeriesChartType.Column;

                    if ((ArraySeriesInfo != null) && (ArraySeriesInfo[IdxSimpleReadoutCurve] != null))
                    {
                        NewSerie.ChartType = SeriesChartType.Spline;
                        //NewSerie.ChartType = SeriesChartType.Line;
                    }

                    #region loop over the simple readout curves
                    for (int j = 0; j < this.InputSimpleData[IdxSimpleReadoutCurve].Count; j++)
                    {
                        //this.chartForPoints.Series[0].Points[j].MarkerColor = Color.FromArgb(128, GlobalInfo.ListCellularPhenotypes[(int)MachineLearning.Classes[j]].ColourForDisplay);
                        DataPoint DP = new DataPoint();
                        double[] Value = new double[1];
                        Value[0] = this.InputSimpleData[IdxSimpleReadoutCurve][j];
                        if (double.IsNaN(Value[0])) continue;
                        DP.YValues = Value;

                        if (X_AxisValues != null)
                            DP.XValue = X_AxisValues[j];
                        else
                            DP.XValue = j;

                      //  DP.AxisLabel = this.InputSimpleData.ListRowNames[j].ToString();

                        if (IsBorder)
                        {
                            DP.MarkerBorderColor = Color.Black;
                            DP.MarkerBorderWidth = 0;// 1;
                        }

                        if ((ArraySeriesInfo != null) && (ArraySeriesInfo[IdxSimpleReadoutCurve] != null))
                        {
                            DP.Color = Color.FromArgb(this.Opacity, ArraySeriesInfo[IdxSimpleReadoutCurve].color);
                            NewSerie.Tag = ArraySeriesInfo[IdxSimpleReadoutCurve];
                            DP.MarkerStyle = ArraySeriesInfo[IdxSimpleReadoutCurve].markerStyle;
                            DP.MarkerSize = this.MarkerSize;
                        }
                        else
                        {
                            int IdxColor = IdxSimpleReadoutCurve % LUTProcess.GetNumberOfColors();
                            NewSerie.Color = LUTProcess.GetColor(IdxColor);
                            DP.Color = Color.FromArgb(this.Opacity, LUTProcess.GetColor(IdxColor));
                            DP.MarkerStyle = MarkerStyle.Circle;
                            DP.MarkerSize = this.MarkerSize;
                        }

                        DP.BorderWidth = this.LineWidth;

                        if (this.InputSimpleData[IdxSimpleReadoutCurve].ListTags != null)
                        {
                            if (j >= this.InputSimpleData[IdxSimpleReadoutCurve].ListTags.Count)
                            {
                                DP.Tag = this.InputSimpleData[IdxSimpleReadoutCurve];
                                NewSerie.Points.Add(DP);

                                continue;
                            }
                            DP.Tag = this.InputSimpleData[IdxSimpleReadoutCurve].ListTags[j];

                            if (DP.Tag.GetType() == typeof(string))
                            {
                                DP.ToolTip = (string)(DP.Tag);
                            }

                            if (DP.Tag.GetType() == typeof(cWellClassType))
                            {
                                DP.Color = ((cWellClassType)(DP.Tag)).ColourForDisplay;
                                DP.ToolTip = ((cWellClassType)(DP.Tag)).GetShortInfo() + Value[0];
                                //  DP.AxisLabel = ((cWellClass)(DP.Tag)).Name;
                                base.CurrentChartArea.AxisX.Interval = 1;

                                if (this.InputSimpleData.ListRowNames != null)
                                    DP.AxisLabel = this.InputSimpleData.ListRowNames[j];

                            }
                            if (DP.Tag.GetType() == typeof(cWell))
                            {
                                DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                                DP.ToolTip = ((cWell)(DP.Tag)).GetShortInfo() + Value[0];

                                if ((this.InputSimpleData.ListRowNames != null) && (j < this.InputSimpleData.ListRowNames.Count))
                                    DP.AxisLabel = this.InputSimpleData.ListRowNames[j];
                            }
                            if (DP.Tag.GetType() == typeof(cDescriptorType))
                            {
                                // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                                DP.ToolTip = ((cDescriptorType)(DP.Tag)).GetShortInfo() + Value[0];
                                DP.AxisLabel = ((cDescriptorType)(DP.Tag)).GetName();
                                base.CurrentChartArea.AxisX.Interval = 1;

                            }
                            if (DP.Tag.GetType() == typeof(cPlate))
                            {
                                // DP.Color = ((cWell)(DP.Tag)).GetClassColor();
                                DP.ToolTip = ((cPlate)(DP.Tag)).GetName() + " : " + Value[0];
                                DP.AxisLabel = ((cPlate)(DP.Tag)).GetName();
                                base.CurrentChartArea.AxisX.Interval = 1;
                            }
                        }
                        NewSerie.Points.Add(DP);
                    }
                    #endregion

                    base.CurrentSeries.Add(NewSerie);
                }
            }
            #endregion

            base.Run();
            base.ChartAreas[0].AxisX.IsLogarithmic = IsLogAxis;
        }
        private void chart1(List<SQLiteHelper.Resource.Row> list)
        {
            this.chart.Series["charcoal"].Points.Clear();
            this.chart.Series["steel"].Points.Clear();
            this.chart.Series["coolant"].Points.Clear();
            this.chart.Series["file"].Points.Clear();

            list.Where(x => x.date.Year.Equals(this.Month.Year))
                .Where(x => x.date.Month.Equals(this.Month.Month))
                .ToList().ForEach(x =>
                {

                    DataPoint dp = new DataPoint();

                    dp = new DataPoint();
                    dp.SetValueXY(x.date.Day, x.charcoal);
                    this.chart.Series["charcoal"].Points.Add(dp);

                    dp = new DataPoint();
                    dp.SetValueXY(x.date.Day, x.steel);
                    this.chart.Series["steel"].Points.Add(dp);

                    dp = new DataPoint();
                    dp.SetValueXY(x.date.Day, x.coolant);
                    this.chart.Series["coolant"].Points.Add(dp);

                    dp = new DataPoint();
                    dp.SetValueXY(x.date.Day, x.file);
                    this.chart.Series["file"].Points.Add(dp);

                });
        }
Beispiel #10
0
 /// <summary>
 ///     将值设定到图表
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SetValue(object sender, EventArgs e)
 {
     var docStatus = CommandExecute.ExecuteMongoSvrCommand(DataBaseCommand.ServerStatusCommand,
             RuntimeMongoDbContext.GetCurrentServer()).Response;
     foreach (var item in CatalogDetailDic.Keys)
     {
         var queryPoint = new DataPoint();
         queryPoint.SetValueXY(DateTime.Now.ToString(CultureInfo.InvariantCulture), SystemStatus.GetValue(docStatus, CatalogDetailDic[item]));
         MonitorGrap.Series[item.Split(".".ToCharArray())[1]].Points.Add(queryPoint);
     }
 }
Beispiel #11
0
 private void DrawIncome()
 {
     dateTimePicker1.Enabled = true;
     dateTimePicker2.Enabled = true;
     chart1.Series.Clear();
     chart1.Legends.Clear();
     chart1.Titles.Clear();
     var s = new Series();
     s.ChartType = SeriesChartType.Line;
     DataTable dt = new DataTable();
     postgreConnection.SelectFrom("orders.price, orders.work_end_date", String.Format("orders where squad={0} and work_start_date>='{1}' and work_end_date<='{2}'",
                                 ((int)listBox1.SelectedValue).ToString(), dateTimePicker1.Value.ToString("yyyy-MM-dd"), dateTimePicker2.Value.ToString("yyyy-MM-dd")),
                                 dt);
     DataPoint dp;
     foreach (DataRow dr in dt.Rows)
     {
         dp = new DataPoint();
         dp.SetValueXY(DateTime.Parse(dr.ItemArray[1].ToString()), (double)(dr[0]));
         dp.Label = DateTime.Parse(dr.ItemArray[1].ToString()).ToShortDateString();
         dp.Color = Color.Coral;
         dp.MarkerSize = 5;
         dp.MarkerColor = Color.Coral;
         dp.MarkerStyle = MarkerStyle.Circle;
         s.Points.Add(dp);
     }
     if (dt.Rows.Count == 0)
         chart1.Titles.Add("Нет данных для отображения.");
     chart1.Series.Clear();
     chart1.Series.Add(s);
     chart1.Series[0].XValueType = ChartValueType.DateTime;
     chart1.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy";
     chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = true;
     chart1.ChartAreas[0].AxisX.Interval = 1;
     chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Years;
     chart1.ChartAreas[0].AxisX.IntervalOffset = 1;
     chart1.ChartAreas[0].RecalculateAxesScale();
     chart1.Series[0].XValueType = ChartValueType.DateTime;
     DateTime minDate = new DateTime(1990, 01, 01).AddSeconds(-1);
     DateTime maxDate = DateTime.Now; // or DateTime.Now;
     chart1.ChartAreas[0].AxisX.Minimum = dateTimePicker1.Value.ToOADate();
     chart1.ChartAreas[0].AxisX.Maximum = dateTimePicker2.Value.ToOADate();
     chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
     chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
     chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
     chart1.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
     chart1.ChartAreas[0].CursorY.IsUserEnabled = true;
     chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
     chart1.ChartAreas[0].AxisY.LabelStyle.Format = "{#,##} рублей";
     chart1.ChartAreas[0].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8, System.Drawing.FontStyle.Regular);
 }
Beispiel #12
0
 private static DataPoint getDataPoint(Object x, Object y)
 {
     DataPoint ret = new DataPoint();
     ret.SetValueXY(x, y);
     return ret;
 }
Beispiel #13
0
        void drawProductsChart(List<State> statesList)
        {
            mainChart.Series.Clear();
            foreach(string name in this.listBox1.SelectedItems)
            {
                ChartArea area = mainChart.ChartAreas[0];

                area.AxisY.Title = "Количество лицензий";
                area.AxisY.Interval = 1;
                area.AxisY.Maximum = this.statesContainer.MaxUsersCount + 1;

                area.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
                area.AxisX.IntervalAutoMode = IntervalAutoMode.FixedCount;
                area.AxisX.Title = "Время";
                area.AxisX.Interval = 30;

                Series series = new Series(name);
                series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                series.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
                series.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32;
                series.BorderWidth = 5;
                series.LegendText = name;

                foreach (State s in statesList)
                {
                    Product p = s.FindProductByName(name);
                    double y = p == null ? 0 : p.currUsersNum;

                    DataPoint point = new DataPoint(series);
                    point.SetValueXY(s.Datetime, y);
                    point.Tag = p;

                    series.Points.Add(point);
                }
                mainChart.Series.Add(series);
            }
        }
Beispiel #14
0
 private void SetData(double num)
 {
     DataPoint temp = new DataPoint();
     if (chart1.InvokeRequired)
     {
         SetDataCallback d = SetData;
         chart1.Invoke(d, num);
     }
     else
     {
         try
         {
             temp.SetValueXY(i, num);
             i++;
             chart1.Series[0].Points.Add(temp);
         }
         catch
         {
         }
     }
 }
Beispiel #15
0
        private void updateMonthsSavings()
        {
            Series savingsSeries = new Series();
            savingsSeries.Color = Color.LimeGreen;
            savingsSeries.LegendText = "יתרה";
            savingsChart.Series.Add(savingsSeries);

            foreach (ColumnHeader col in monthsCompListView.Columns)
            {
                if (col.Tag != null)
                {
                    double incomesTotal = 0;
                    double expensesTotal = 0;
                    foreach (ListViewGroup group in monthsCompListView.Groups)
                    {
                        double total = 0;
                        foreach (ListViewItem item in group.Items)
                            total += Double.Parse(item.SubItems[col.Index].Text);

                        if (group.Header.ToString().StartsWith(Database.INCOME_STRING))
                            incomesTotal += total;
                        else
                            expensesTotal += total;
                    }

                    double savings = incomesTotal - expensesTotal;
                    DataPoint pSavings = new DataPoint();
                    if (savings < 0)
                        pSavings.Color = Color.Red;

                    pSavings.SetValueXY(((DateTime)col.Tag).ToShortDateString(), savings);
                    pSavings.ToolTip = "יתרה" + ":" + savings.ToString("N", new CultureInfo("en-US")) + " " + Database.NIS_SIGN;
                    savingsSeries.Points.Add(pSavings);
                }
            }
        }
Beispiel #16
0
        private void updateMonthsIncomesExpenesChart()
        {
            Series incomesSeries = new Series();
            incomesSeries.Color = Color.LimeGreen;
            incomesSeries.LegendText = Database.INCOME_STRING;
            monthsIncomesExpensesChart.Series.Add(incomesSeries);

            Series expensesSeries = new Series();
            expensesSeries.Color = Color.Red;
            expensesSeries.LegendText = Database.INCOME_STRING;
            monthsIncomesExpensesChart.Series.Add(expensesSeries);

            foreach (ColumnHeader col in monthsCompListView.Columns)
            {
                if (col.Tag != null)
                {
                    double incomesTotal = 0;
                    double expensesTotal = 0;
                    foreach (ListViewGroup group in monthsCompListView.Groups)
                    {
                        double total = 0;
                        foreach (ListViewItem item in group.Items)
                            total += Double.Parse(item.SubItems[col.Index].Text);

                        if (group.Header.ToString().StartsWith(Database.INCOME_STRING))
                            incomesTotal += total;
                        else
                            expensesTotal += total;
                    }

                    DataPoint pIncomes = new DataPoint();
                    pIncomes.SetValueXY(((DateTime)col.Tag).ToShortDateString(), incomesTotal);
                    pIncomes.ToolTip = Database.INCOME_STRING + ":" + incomesTotal.ToString("N", new CultureInfo("en-US")) + " " + Database.NIS_SIGN;
                    incomesSeries.Points.Add(pIncomes);

                    DataPoint pExpenses = new DataPoint();
                    pExpenses.SetValueXY(((DateTime)col.Tag).ToShortDateString(), expensesTotal);
                    pExpenses.ToolTip = Database.EXPENSES_STRING + ":" + expensesTotal.ToString("N", new CultureInfo("en-US")) + " " + Database.NIS_SIGN;
                    expensesSeries.Points.Add(pExpenses);
                }
            }
        }
Beispiel #17
0
        private void updateMonthsExpensesChart()
        {
            foreach (ListViewGroup group in monthsCompListView.Groups)
            {
                if (group.Header.ToString().StartsWith(Database.INCOME_STRING))
                    continue;
                Series s = new Series();
                s.ChartType = SeriesChartType.StackedColumn;
                s.LegendText = group.Tag.ToString();
                monthsExpensesChart.Series.Add(s);

                foreach (ColumnHeader col in monthsCompListView.Columns)
                {
                    double total = 0;
                    if (col.Tag != null)
                    {
                        foreach (ListViewItem item in group.Items)
                            total += Double.Parse(item.SubItems[col.Index].Text);
                        DataPoint point = new DataPoint();
                        point.SetValueXY(((DateTime)col.Tag).ToShortDateString(), total);
                        point.ToolTip = group.Header + total.ToString("N", new CultureInfo("en-US")) + " " + Database.NIS_SIGN;
                        s.Points.Add(point);
                    }

                }

            }
        }
Beispiel #18
0
        public void TestDisplayRefresh()
        {
            if (testDisplayModeComboBox.SelectedIndex < 0)
            {

            }
            else if (!RegularExpression.DoubleCheck(minYAxisTestDisplayTextBox.Text))
            {
                MessageBox.Show("Min Y Axis value is worng. Check Please.");

                minYAxisTestDisplayTextBox.Text = "0.0";
                minYAxisTestDisplayTextBox.Focus();
                minYAxisTestDisplayTextBox.SelectAll();
            }
            else if (!RegularExpression.DoubleCheck(maxYAxisTestDisplayTextBox.Text))
            {
                MessageBox.Show("Max Y Axis value is worng. Check Please.");

                maxYAxisTestDisplayTextBox.Text = "1.0";
                maxYAxisTestDisplayTextBox.Focus();
                maxYAxisTestDisplayTextBox.SelectAll();
            }
            else if (double.Parse(minYAxisTestDisplayTextBox.Text) < 0)
            {
                MessageBox.Show("Min Y Axis value must be 0 or bigger. Check Please.");

                minYAxisTestDisplayTextBox.Text = "0.0";
                maxYAxisTestDisplayTextBox.Focus();
                maxYAxisTestDisplayTextBox.SelectAll();
            }
            else if (double.Parse(maxYAxisTestDisplayTextBox.Text) <= 0)
            {
                MessageBox.Show("Max Y Axis value must be bigger than 0. Check Please.");

                maxYAxisTestDisplayTextBox.Text = "1.0";
                maxYAxisTestDisplayTextBox.Focus();
                maxYAxisTestDisplayTextBox.SelectAll();
            }
            else if (double.Parse(maxYAxisTestDisplayTextBox.Text) <= double.Parse(minYAxisTestDisplayTextBox.Text))
            {
                MessageBox.Show("Max Y Axis value must be bigger than min Y Axis value. Check Please.");

                minYAxisTestDisplayTextBox.Text = "0.0";
                maxYAxisTestDisplayTextBox.Text = "1.0";
                maxYAxisTestDisplayTextBox.Focus();
                maxYAxisTestDisplayTextBox.SelectAll();
            }
            else if (!useTimeStampCheckBox.Checked)
            {
                int maxXAxis = 0;
                foreach (LearningSetup processSetup in learningSetupList) maxXAxis += processSetup.TrainingEpoch;

                testDisplayChart.ChartAreas[0].Area3DStyle.Enable3D = false;

                testDisplayChart.ChartAreas[0].AxisX.Minimum = 0;
                testDisplayChart.ChartAreas[0].AxisX.Maximum = maxXAxis;
                testDisplayChart.ChartAreas[0].AxisY.Minimum = double.Parse(minYAxisTestDisplayTextBox.Text);
                testDisplayChart.ChartAreas[0].AxisY.Maximum = double.Parse(maxYAxisTestDisplayTextBox.Text);

                List<DisplayData> displayDataList = new List<DisplayData>();

                try
                {
                    switch (testDisplayModeComboBox.SelectedIndex)
                    {
                        case 0:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch)
                                    {
                                        displayData.InsertValue(testData.MeanSquredError);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.InsertValue(testData.MeanSquredError);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 1:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch)
                                    {
                                        displayData.InsertValue(testData.MeanSemanticStress);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.InsertValue(testData.MeanSemanticStress);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 2:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch)
                                    {
                                        displayData.InsertValue(testData.MeanCrossEntropy);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.InsertValue(testData.MeanCrossEntropy);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 3:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch)
                                    {
                                        if (testData.Correctness) displayData.InsertValue(1);
                                        else displayData.InsertValue(0);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    if (testData.Correctness) newDisplayData.InsertValue(1);
                                    else newDisplayData.InsertValue(0);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 4:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch)
                                    {
                                        if (testData.MeanActiveUnitActivation == testData.MeanActiveUnitActivation)
                                        {
                                            displayData.InsertValue(testData.MeanActiveUnitActivation);
                                            isExist = true;
                                        }
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    if (testData.MeanActiveUnitActivation == testData.MeanActiveUnitActivation)
                                    {
                                        DisplayData newDisplayData = new DisplayData();
                                        newDisplayData.Epoch = testData.Epoch;
                                        newDisplayData.InsertValue(testData.MeanActiveUnitActivation);
                                        displayDataList.Add(newDisplayData);
                                    }
                                }
                            }
                            break;
                        case 5:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch)
                                    {
                                        if (testData.MeanInactiveUnitActivation == testData.MeanInactiveUnitActivation)
                                        {
                                            displayData.InsertValue(testData.MeanInactiveUnitActivation);
                                            isExist = true;
                                        }
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    if (testData.MeanInactiveUnitActivation == testData.MeanInactiveUnitActivation)
                                    {
                                        DisplayData newDisplayData = new DisplayData();
                                        newDisplayData.Epoch = testData.Epoch;
                                        newDisplayData.InsertValue(testData.MeanInactiveUnitActivation);
                                        displayDataList.Add(newDisplayData);
                                    }
                                }
                            }
                            break;
                    }
                    testDisplayChart.Series.Clear();
                    testDisplayChart.Legends.Clear();

                    Series dataSeries = new Series();
                    dataSeries.ChartType = SeriesChartType.Line;
                    testDisplayChart.Series.Add(dataSeries);

                    foreach (DisplayData displayData in displayDataList)
                    {
                        DataPoint dataPoint = new DataPoint();
                        dataPoint.SetValueXY(displayData.Epoch, displayData.Value);
                        dataSeries.Points.Add(dataPoint);
                    }
                }
                catch
                {

                }
            }
            else if (useTimeStampCheckBox.Checked)
            {
                int maxXAxis = 0;
                foreach (TestData testData in simulator.TestDataList) if (testData.TimeStamp > maxXAxis) maxXAxis = testData.TimeStamp;

                testDisplayChart.ChartAreas[0].Area3DStyle.Enable3D = true;
                testDisplayChart.ChartAreas[0].Area3DStyle.PointDepth = 50;

                testDisplayChart.ChartAreas[0].AxisX.Minimum = 0;
                testDisplayChart.ChartAreas[0].AxisX.Maximum = maxXAxis;
                testDisplayChart.ChartAreas[0].AxisY.Minimum = double.Parse(minYAxisTestDisplayTextBox.Text);
                testDisplayChart.ChartAreas[0].AxisY.Maximum = double.Parse(maxYAxisTestDisplayTextBox.Text);

                List<DisplayData> displayDataList = new List<DisplayData>();

                try
                {
                    switch (testDisplayModeComboBox.SelectedIndex)
                    {
                        case 0:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch && testData.TimeStamp == displayData.TimeStamp)
                                    {
                                        displayData.InsertValue(testData.MeanSquredError);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.TimeStamp = testData.TimeStamp;
                                    newDisplayData.InsertValue(testData.MeanSquredError);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 1:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch && testData.TimeStamp == displayData.TimeStamp)
                                    {
                                        displayData.InsertValue(testData.MeanSemanticStress);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.TimeStamp = testData.TimeStamp;
                                    newDisplayData.InsertValue(testData.MeanSemanticStress);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 2:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch && testData.TimeStamp == displayData.TimeStamp)
                                    {
                                        displayData.InsertValue(testData.MeanCrossEntropy);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.TimeStamp = testData.TimeStamp;
                                    newDisplayData.InsertValue(testData.MeanCrossEntropy);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 3:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch && testData.TimeStamp == displayData.TimeStamp)
                                    {
                                        if (testData.Correctness) displayData.InsertValue(1);
                                        else displayData.InsertValue(0);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.TimeStamp = testData.TimeStamp;
                                    if (testData.Correctness) newDisplayData.InsertValue(1);
                                    else newDisplayData.InsertValue(0);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                        case 4:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch && testData.TimeStamp == displayData.TimeStamp)
                                    {
                                        if (testData.MeanInactiveUnitActivation == testData.MeanInactiveUnitActivation)
                                        {
                                            displayData.InsertValue(testData.MeanActiveUnitActivation);
                                            isExist = true;
                                        }
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    if (testData.MeanInactiveUnitActivation == testData.MeanInactiveUnitActivation)
                                    {
                                        DisplayData newDisplayData = new DisplayData();
                                        newDisplayData.Epoch = testData.Epoch;
                                        newDisplayData.TimeStamp = testData.TimeStamp;
                                        newDisplayData.InsertValue(testData.MeanActiveUnitActivation);
                                        displayDataList.Add(newDisplayData);
                                    }
                                }
                            }
                            break;
                        case 5:
                            foreach (TestData testData in simulator.TestDataList)
                            {
                                bool isExist = false;
                                foreach (DisplayData displayData in displayDataList)
                                {
                                    if (testData.Epoch == displayData.Epoch && testData.TimeStamp == displayData.TimeStamp)
                                    {
                                        displayData.InsertValue(testData.MeanInactiveUnitActivation);
                                        isExist = true;
                                        break;
                                    }
                                }
                                if (!isExist)
                                {
                                    DisplayData newDisplayData = new DisplayData();
                                    newDisplayData.Epoch = testData.Epoch;
                                    newDisplayData.TimeStamp = testData.TimeStamp;
                                    newDisplayData.InsertValue(testData.MeanInactiveUnitActivation);
                                    displayDataList.Add(newDisplayData);
                                }
                            }
                            break;
                    }
                    testDisplayChart.Series.Clear();
                    testDisplayChart.Legends.Clear();
                    testDisplayChart.Legends.Add(new Legend());
                    testDisplayChart.Legends[0].Name = "";

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

                    foreach (DisplayData displayData in displayDataList)
                    {
                        if (!dataSeriesDictionary.ContainsKey(displayData.Epoch))
                        {
                            Series newSeries = new Series();
                            newSeries.ChartType = SeriesChartType.Line;
                            newSeries.Name = "Epoch" + displayData.Epoch.ToString();
                            testDisplayChart.Series.Add(newSeries);
                            dataSeriesDictionary[displayData.Epoch] = newSeries;

                            LegendItem newLegendItem = new LegendItem();
                            newLegendItem.ImageStyle = LegendImageStyle.Line;
                            //newLegendItem.Name = "Epoch" + displayData.Epoch.ToString();
                            newLegendItem.SeriesName = displayData.Epoch.ToString();
                            testDisplayChart.Legends[0].CustomItems.Add(newLegendItem);
                        }
                        DataPoint dataPoint = new DataPoint();
                        dataPoint.SetValueXY(displayData.TimeStamp, displayData.Value);
                        dataSeriesDictionary[displayData.Epoch].Points.Add(dataPoint);
                    }
                }
                catch
                {

                }
            }
        }
Beispiel #19
0
        /// <summary>
        /// 初期化メソッド
        /// </summary>
        /// <param name="wavedata">計測した脳波データ</param>
        /// <param name="synchroDataSet">同期データセット</param>
        private void Initialize(List <double> wavedata, List <MySynchroDataSet> synchroDataSet)
        {
            this.Size            = new System.Drawing.Size(640, 400);
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.StartPosition   = FormStartPosition.Manual;
            this.Location        = new System.Drawing.Point(200, 200);
            this.Text            = "TimingconfirmForm";

            this.prenumber = 0;             //初期化

            #region エクセルオブジェクト生成

            wavekey   = "wave";
            chart     = new System.Windows.Forms.DataVisualization.Charting.Chart();
            chartArea = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
            legend    = new System.Windows.Forms.DataVisualization.Charting.Legend();
            series    = new System.Windows.Forms.DataVisualization.Charting.Series();
            title     = new System.Windows.Forms.DataVisualization.Charting.Title();

            #endregion

            #region エクセルオブジェクト初期化

            ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
            this.SuspendLayout();

            chart.Series.Clear();
            chart.Series.Add(wavekey);

            chart.Series[wavekey].ChartType = chartControl.SeriesChartType.Line;
            chartArea.AxisX.Title           = "秒数[s]    (Noデータ:青 Yesデータ:赤)\n";
            chartArea.AxisY.Title           = "脳波の離散値";
            //chartArea.AxisY.TextOrientation = chartControl.TextOrientation.Horizontal;

            double           second = 0;
            int              count  = wavedata.Count;
            int              jj     = 0;
            MySynchroDataSet tmp    = synchroDataSet[0];
            for (int ii = 0; ii < count; ii++)
            {
                second += (1.0 / 512.0);

                chartControl.DataPoint pointData = new System.Windows.Forms.DataVisualization.Charting.DataPoint();
                pointData.SetValueXY(second, wavedata[ii]);

                if ((tmp.startindex <= ii && tmp.lastindex >= ii))
                {
                    //Yesならば赤色
                    if (string.Equals(tmp.type, "Yes"))
                    {
                        pointData.Color = System.Drawing.Color.Red;
                    }

                    //Noならば青色
                    else if (string.Equals(tmp.type, "No"))
                    {
                        pointData.Color = System.Drawing.Color.Blue;
                    }

                    if (tmp.lastindex == ii && jj < synchroDataSet.Count - 1)
                    {
                        tmp = synchroDataSet[++jj];
                    }
                }

                else
                {
                    pointData.Color = System.Drawing.Color.Blue;
                }

                chart.Series[wavekey].Points.Add(pointData);
            }

            chartArea.AxisX.Interval = 5;       //5s間隔

            chart.ChartAreas.Add(chartArea);
            this.chart.Size = new System.Drawing.Size(this.Width - 10, this.Height - 20);
            chart.Anchor    = (AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top);

            this.Controls.Add(this.chart);
            this.Name = "SynchroData";

            ((System.ComponentModel.ISupportInitialize)(this.chart)).EndInit();
            this.ResumeLayout(false);

            #endregion

            this.Show();
        }
Beispiel #20
0
        public void DrawData(int oper, double number, DbConnect pgc, string from,string formName =null)
        {
            if (formName != null)
            {
                this.Text = formName;
                button3.Enabled = true;
            }
            bool compRes = false;
            chart1.Series.Clear();
            Series sIncome = new Series(), sExpenses = new Series();
            sIncome.ChartType = sExpenses.ChartType = SeriesChartType.Line;
            DataTable dt = new DataTable();
            DataPoint dp = new DataPoint();
            DataTable ordersTable = new DataTable();
            pgc.SelectFrom("*", from, ordersTable);
            sIncome.LegendText = "Доход";
            sIncome.Color = Color.Blue;
            sExpenses.Color = Color.Red;
            sExpenses.LegendText = "Расход";
            foreach (DataRow dr in ordersTable.Rows)
            {
                dp = new DataPoint();
                dp.Color = Color.Blue;
                dp.MarkerSize = 5;
                dp.MarkerColor = Color.Blue;
                dp.MarkerStyle = MarkerStyle.Circle;
                dp.IsEmpty = false;
                pgc.SelectFromFunc("*", "order_expenses_income", dr.ItemArray[0].ToString(), dt);
                if (oper != -1 && number > 0)
                    if (Compare(oper, number, dt.Rows[0].ItemArray[0]) && Compare(oper, number, dt.Rows[0].ItemArray[1]))
                        compRes = true;
                    else
                        compRes = false;
                if ((compRes) || (oper == -1 && number ==-1))
                {
                    try
                    {
                        dp.SetValueXY(DateTime.Parse(dr.ItemArray[6].ToString()), dt.Rows[0].ItemArray[0]);
                        dp.Label = DateTime.Parse(dr.ItemArray[6].ToString()).ToShortDateString() + " " + dr.ItemArray[9].ToString();
                        sIncome.Points.Add(dp);
                    }
                    catch
                    {

                    }
                    dp = new DataPoint();
                    dp.Color = Color.Red;
                    dp.MarkerSize = 5;
                    dp.MarkerColor = Color.Red;
                    dp.MarkerStyle = MarkerStyle.Circle;
                    dp.IsEmpty = false;
                    dp.SetValueXY(DateTime.Parse(dr.ItemArray[6].ToString()), dt.Rows[0].ItemArray[1]);
                    dp.Label = DateTime.Parse(dr.ItemArray[6].ToString()).ToShortDateString() + " " + dr.ItemArray[9].ToString();
                    sExpenses.Points.Add(dp);
                }
                dt.Clear();
            }
            sExpenses.XValueType = ChartValueType.Date;
            sIncome.XValueType = ChartValueType.Date;
            //chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, 10);
            chart1.Series.Add(sExpenses);
            chart1.Series.Add(sIncome);
            chart1.ChartAreas[0].RecalculateAxesScale();
        }
Beispiel #21
0
        void drawUsersChart(List<State> statesList, YearAndMonth Range)
        {
            mainChart.Series.Clear();
            User CurrentUser = null;
            foreach (User U in this.statesContainer.Users)
            {
                if (U.Name == this.listBox1.SelectedItem.ToString())
                    CurrentUser = U;
            }

            if (CurrentUser != null)
            {
                ChartArea area = mainChart.ChartAreas[0];
                area.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Days;
                area.AxisX.Interval = 1;
                area.AxisX.Title = "Дни";
                area.AxisY.Title = "Время, ч.";
                area.AxisY.Interval = 0.5;
                area.AxisY.Maximum = 12;

                Dictionary<Product, Series> data = new Dictionary<Product, Series>();

                foreach (DateTime date in this.statesContainer.Dates)
                {
                    if (date.Year == Range.Date.Year && date.Month == Range.Date.Month)
                    {
                        Dictionary<Product, double> dailyData = this.statesContainer.UserTimePerDay(CurrentUser, date);

                        foreach (Product P in dailyData.Keys)
                        {
                            if (!data.ContainsKey(P))
                            {
                                Series series = new Series(P.Name);
                                series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
                                series.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Date;
                                series.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32;
                                series.LegendText = P.Name;

                                data.Add(P, series);
                            }
                            DataPoint point = new DataPoint(data[P]);
                            point.SetValueXY(date, dailyData[P]);
                            point.Tag = date;
                            data[P].Points.Add(point);
                        }
                    }
                }

                foreach (KeyValuePair<Product, Series> pair in data)
                {
                    mainChart.Series.Add(pair.Value);
                }
            }
        }
        private Chart GetPieChart()
        {
            Chart chart = new Chart();
            ChartArea area = new ChartArea();
            Series series = new Series();
            DataPoint point;

            List<DeviceStats>[] levels = GetLevels(ReportDays);
            Color[] colors = GetLevelColors();
            int totalDeviceCount;

            area.Area3DStyle.Enable3D = true;
            series.ChartType = SeriesChartType.Pie;
            totalDeviceCount = levels.Sum(level => level.Count);

            for (int i = 0; i < levels.Length; i++)
            {
                if (levels[i].Count > 0)
                {
                    point = new DataPoint();
                    point.SetValueXY(string.Format("L{0} ({1:N0}%)", i, 100.0D * levels[i].Count / totalDeviceCount), levels[i].Count);
                    point.Color = colors[i];
                    point.Font = new Font(FontFamily.GenericSansSerif, 40.0F);
                    series.Points.Add(point);
                }
            }

            chart.Width = 1200;
            chart.Height = 1200;
            chart.ChartAreas.Add(area);
            chart.Series.Add(series);

            return chart;
        }
Beispiel #23
0
        //
        //переделать всё
        //
        private void connect()
        {
            if (comboBox1.SelectedIndex != -1)
                MyUsbFinder = new UsbDeviceFinder(Convert.ToInt32(devices_libusb[comboBox1.SelectedIndex].VID, 16),
                    Convert.ToInt32(devices_libusb[comboBox1.SelectedIndex].PID, 16));
            DataPoint temp = new DataPoint();
            ErrorCode ec = ErrorCode.None;
            try
            {
                //открываем поток
                MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder);

                if (MyUsbDevice == null) throw new Exception("Device Not Found.");

                IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice;
                if (!ReferenceEquals(wholeUsbDevice, null))
                {
                    wholeUsbDevice.SetConfiguration(1);
                    wholeUsbDevice.ClaimInterface(0);
                }

                //читает 1ый эндпоинт
                UsbEndpointReader reader = MyUsbDevice.OpenEndpointReader((ReadEndpointID)comboBox2.SelectedItem);

                byte[] readBuffer = new byte[1024];
                int bytesRead;

                //Возвращает данные или ошибку, если через 5 секунд ничего не было возвращено
                ec = reader.Read(readBuffer, 5000, out bytesRead);

                if (bytesRead == 0) throw new Exception(string.Format("{0}:No more bytes!", ec));
                try
                {
                    if (trying)
                    {
                        temp.SetValueXY(i,
                            Convert.ToDouble(Encoding.Default.GetString(readBuffer, 0, bytesRead).Replace('.', ',')));
                        i++;
                        chart1.Series[0].Points.Add(temp);
                        data.Add(Encoding.Default.GetString(readBuffer, 0, bytesRead));
                    }
                }
                catch
                {
                    trying = false;
                }
                textBox2.AppendText(Encoding.Default.GetString(readBuffer, 0, bytesRead));
            }
            catch (Exception ex)
            {
                //кидает ошибку и останавливает таймер при ошибке
                timer1.Stop();
                MessageBox.Show((ec != ErrorCode.None ? ec + ":" : String.Empty) + ex.Message);
            }
            finally
            {
                //закрывает поток
                if (MyUsbDevice != null)
                {
                    if (MyUsbDevice.IsOpen)
                    {
                        IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice;
                        if (!ReferenceEquals(wholeUsbDevice, null))
                        {
                            wholeUsbDevice.ReleaseInterface(0);
                        }

                        MyUsbDevice.Close();
                    }
                    MyUsbDevice = null;
                    UsbDevice.Exit();
                }
            }
        }
Beispiel #24
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            byte[] content = new tobid.util.ScreenUtil().screenCaptureAsByte(665, 517, 43, 14);
            Bitmap bitmap = new Bitmap(new System.IO.MemoryStream(content));
            bitmap.Save("PRICE.bmp");

            String price = orc.IdentifyStringFromPic(bitmap);
            System.Console.WriteLine(price);

            Series series = this.chart1.Series[0];
            DataPoint dp = new DataPoint();
            dp.SetValueXY("01", Int32.Parse(price));

            int max = Int32.Parse(price) + 300;

            this.chart1.ChartAreas[0].AxisY.Maximum = max > this.chart1.ChartAreas[0].AxisY.Minimum ? max : this.chart1.ChartAreas[0].AxisY.Minimum+100;
            series.Points.Add(dp);
        }
Beispiel #25
0
        private List<DataPoint> sequenciaToPoints(List<String> sequencia)
        {
            List<DataPoint> pontos = new List<DataPoint>();
            List<Int32> blocos = sequencia.Select(blk => Convert.ToInt32(blk)).ToList();
            Int32 index = 0;

            foreach (var bloco in blocos)
            {
                DataPoint block = new DataPoint();
                block.SetValueXY(bloco, index++);
                pontos.Add(block);
            }

            return pontos;
        }
        /// <summary>
        /// Updates the amount chart.
        /// </summary>
        private void UpdateAmountChart()
        {
            AmountChart.Series[0].Points.Clear();
            AmountChart.Series[1].Points.Clear();

            // Set the data points for the first chart
            foreach (WalletJournal journal in m_ccpCharacter.WalletJournal.OrderByDescending(journal => journal.Date))
            {
                using (DataPoint dataPoint = new DataPoint())
                {
                    dataPoint.SetValueXY(journal.Date.ToLocalTime(), journal.Amount);
                    dataPoint.Color = journal.Amount < 0 ? Color.DarkRed : Color.DarkGreen;
                    dataPoint.ToolTip = $"{journal.Date.ToLocalTime():G}{Environment.NewLine}{journal.Amount:N2} ISK";

                    // Add the data point to series
                    AmountChart.Series[0].Points.Add(dataPoint.Clone());
                }
            }

            // Set the data points for the second chart
            using (DataPoint positiveSumDataPoint = new DataPoint())
            {
                decimal positiveSum =
                    m_ccpCharacter.WalletJournal.Where(journal => journal.Amount > 0).Sum(journal => journal.Amount);
                positiveSumDataPoint.SetValueXY(0, positiveSum);
                positiveSumDataPoint.Color = Color.DarkGreen;
                positiveSumDataPoint.ToolTip = $"Inflow{Environment.NewLine}{positiveSum:N2} ISK";
                // Add the data point to series
                AmountChart.Series[1].Points.Add(positiveSumDataPoint.Clone());
            }

            using (DataPoint negativeSumDataPoint = new DataPoint())
            {
                decimal negativeSum =
                    m_ccpCharacter.WalletJournal.Where(journal => journal.Amount < 0).Sum(journal => journal.Amount);
                negativeSumDataPoint.SetValueXY(0, negativeSum);
                negativeSumDataPoint.Color = Color.DarkRed;
                negativeSumDataPoint.ToolTip = $"Outflow{Environment.NewLine}{negativeSum:N2} ISK";

                // Add the data point to series
                AmountChart.Series[1].Points.Add(negativeSumDataPoint.Clone());
            }
        }
        /// <summary>
        /// Updates the balance chart.
        /// </summary>
        private void UpdateBalanceChart()
        {
            BalanceChart.Series[0].Points.Clear();

            // Set the data points
            foreach (WalletJournal journal in m_ccpCharacter.WalletJournal.OrderByDescending(journal => journal.Date))
            {
                using (DataPoint dataPoint = new DataPoint())
                {
                    dataPoint.SetValueXY(journal.Date.ToLocalTime(), journal.Balance);
                    dataPoint.ToolTip = $"{journal.Date.ToLocalTime():G}{Environment.NewLine}{journal.Balance:N2} ISK";

                    BalanceChart.Series[0].Points.Add(dataPoint.Clone());
                }
            }
        }
        /// <summary>
        /// Phase图
        /// </summary>
        private void InitHiringTrackingChart()
        {
            if (DataCenter.HiringTrackingDataSet.Count == 0) return;
            var QuerySeries = new Series("First Date")
            {
                ChartType = SeriesChartType.Line,
                XValueType = ChartValueType.String,
                YValueType = ChartValueType.Int32
            };
            HiringTrackingchart.Series.Clear();
            HiringTrackingchart.Series.Add(QuerySeries);

            List<HiringTracking> Target;
            if (Position == SystemManager.strTotal)
            {
                return;
            }
            else
            {
                Target = DataCenter.GetHiringTrackByPosition(Position);
            }

            DateTime BaseDate = DataCenter.GetBasicPositionInfo(Position).OpenDate;

            var queryPoint = new DataPoint();
            queryPoint.SetValueXY("Screen", Target.Min<HiringTracking>((x) =>
            {
                if (x.ScreenDate == DateTime.MinValue)
                {
                    return 999;
                }
                else
                {
                    return (x.ScreenDate.Date - BaseDate.Date).Days;
                };
            }));
            HiringTrackingchart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("1st", Target.Min<HiringTracking>((x) =>
            {
                if (x.FirstInterviewDate == DateTime.MinValue)
                {
                    return 999;
                }
                else
                {
                    return (x.FirstInterviewDate.Date - BaseDate.Date).Days;
                };
            }));
            HiringTrackingchart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("2nd", Target.Min<HiringTracking>((x) =>
            {
                if (x.SecondInterviewDate == DateTime.MinValue)
                {
                    return 999;
                }
                else
                {
                    return (x.SecondInterviewDate.Date - BaseDate.Date).Days;
                };
            }));
            HiringTrackingchart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("3rd", Target.Min<HiringTracking>((x) =>
            {
                if (x.ThirdInterviewDate == DateTime.MinValue)
                {
                    return 999;
                }
                else
                {
                    return (x.ThirdInterviewDate.Date - BaseDate.Date).Days;
                };
            }));
            HiringTrackingchart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("ANOB", Target.Min<HiringTracking>((x) =>
            {
                if (x.OfferOfferDate == DateTime.MinValue)
                {
                    return 999;
                }
                else
                {
                    return (x.OfferOfferDate.Date - BaseDate.Date).Days;
                };
            }));
            HiringTrackingchart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("OB", Target.Min<HiringTracking>((x) =>
            {
                if (x.OnboardDate == DateTime.MinValue)
                {
                    return 999;
                }
                else
                {
                    return (x.OnboardDate.Date - BaseDate.Date).Days;
                };
            }));
            HiringTrackingchart.Series[0].Points.Add(queryPoint);
        }
        void Refresh()
        {
            base.CurrentSeries.Clear();

            double GlobalMinX = 0;
            double GlobalMaxX = 0;

            if (this.SliderForMarkerSizeBinSize.radioButtonMinMaxAutomated.Checked)
            {
                GlobalMinX = this.InputSimpleData.Min();
                GlobalMaxX = this.InputSimpleData.Max();
            }
            else
            {
                GlobalMinX = (double)this.SliderForMarkerSizeBinSize.numericUpDownMin.Value;
                GlobalMaxX = (double)this.SliderForMarkerSizeBinSize.numericUpDownMax.Value;

            }

            for (int IdxSerie = 0; IdxSerie < InputSimpleData.Count; IdxSerie++)
            {
                if (InputSimpleData[IdxSerie].Count == 0) continue;

                Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(base.InputSimpleData[IdxSerie].Name + "_Histogram");
                NewSerie.Tag = base.InputSimpleData[IdxSerie].Tag;

                cHistogramBuilder HB = new cHistogramBuilder();
                HB.SetInputData(new cExtendedTable(InputSimpleData[IdxSerie]));

                if (this.SliderForMarkerSizeBinSize.radioButtonMinMaxAutomated.Checked)
                {
                    HB.Min = GlobalMinX;
                    HB.Max = GlobalMaxX;
                }
                else
                {
                    HB.Min = (double)this.SliderForMarkerSizeBinSize.numericUpDownMin.Value;
                    HB.Max = (double)this.SliderForMarkerSizeBinSize.numericUpDownMax.Value;
                }

                HB.IsBinNumberMode = this.SliderForMarkerSizeBinSize.radioButtonBinNumber.Checked;
                HB.BinSize = (double)this.SliderForMarkerSizeBinSize.numericUpDownBinSize.Value;

                if(this.BinNumber==-1)
                    HB.BinNumber = HB.Max - HB.Min+1;
                else
                    HB.BinNumber = this.BinNumber;

                HB.Run();

                CurrentHistogram = HB.GetOutPut();

                //if (ISPoint)
                //    NewSerie.ChartType = SeriesChartType.Point;
                //if (IsLine)
                //    NewSerie.ChartType = SeriesChartType.Line;
                //if (IsBar)
               // NewSerie.ChartType = SeriesChartType.Column;

                //NewSerie.ChartType = SeriesChartType.StackedColumn;
                if (this.Is100)
                {
                    NewSerie.ChartType = SeriesChartType.StackedColumn100;
                    base.LabelAxisY = "Frequency %";
                    base.CurrentChartArea.AxisY.Minimum = 0;
                    base.CurrentChartArea.AxisY.Maximum = 100;
                }
                else
                {

                    NewSerie.ChartType = SeriesChartType.StackedColumn;
                    base.LabelAxisY = "Frequency";
                    base.CurrentChartArea.AxisY.Minimum = Double.NaN;
                    base.CurrentChartArea.AxisY.Maximum = Double.NaN;
                 //   base.CurrentChartArea.AxisY.
                }
                //SeriesPos[i].ChartType = SeriesChartType.StackedColumn;

             //   double Step = (GlobalMaxX - GlobalMinX + 1) / CurrentHistogram[0].Count;

                for (int j = 0; j < CurrentHistogram[0].Count; j++)
                {
                    double[] Value = new double[1];
                    Value[0] = CurrentHistogram[1][j];

                    DataPoint DP = new DataPoint();
                    DP.SetValueXY(/*Step * j + GlobalMinX*/ CurrentHistogram[0][j], Value[0]);

                    DP.Tag = InputSimpleData[IdxSerie].Tag;

                    if (IsBorder)
                    {
                        DP.MarkerBorderColor = Color.Black;
                        DP.MarkerBorderWidth = 1;
                        DP.BorderColor = Color.Black;
                        DP.BorderWidth = 1;
                    }
                    else
                    {
                        DP.BorderWidth = 0;
                        DP.MarkerBorderWidth = 0;
                    }

                    if (InputSimpleData[IdxSerie].Tag != null)
                    {
                        if (InputSimpleData[IdxSerie].Tag.GetType() == typeof(cWellClassType))
                         {
                             DP.Color = ((cWellClassType)(InputSimpleData[IdxSerie].Tag)).ColourForDisplay;
                             DP.ToolTip = ((cWellClassType)(InputSimpleData[IdxSerie].Tag)).Name + "\n";
                         }
                        if (InputSimpleData[IdxSerie].Tag.GetType() == typeof(cCellularPhenotype))
                        {
                            DP.Color = ((cCellularPhenotype)(InputSimpleData[IdxSerie].Tag)).ColourForDisplay;
                            DP.ToolTip = ((cCellularPhenotype)(InputSimpleData[IdxSerie].Tag)).Name + "\n";
                        }
                    }

                    DP.ToolTip += DP.XValue.ToString("N2") + " :\n" + DP.YValues[0];

                    NewSerie.Points.Add(DP);
                }
                base.CurrentSeries.Add(NewSerie);
            }
             //   base.LabelAxisY = "Frequency";
            base.Update();
        }
        /// <summary>
        /// Phase图
        /// </summary>
        private void InitPhaseChart()
        {
            if (DataCenter.HiringTrackingDataSet.Count == 0) return;
            var QuerySeries = new Series("Pileline")
            {
                ChartType = SeriesChartType.Line,
                XValueType = ChartValueType.String,
                YValueType = ChartValueType.Int32
            };
            PhaseChart.Series.Clear();
            PhaseChart.Series.Add(QuerySeries);

            List<HiringTracking> Target;
            if (Position == SystemManager.strTotal)
            {
                Target = DataCenter.GetHiringTrackingDataSet();
            }
            else
            {
                Target = DataCenter.GetHiringTrackByPosition(Position);
            }

            var queryPoint = new DataPoint();
            queryPoint.SetValueXY("Pipeline", Target.Count());
            PhaseChart.Series[0].Points.Add(queryPoint);


            queryPoint = new DataPoint();
            queryPoint.SetValueXY("ScreenPass", Target.Count((x) =>
            {
                return !string.IsNullOrEmpty(x.FirstInterviewer);
            }));
            PhaseChart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("1stPass", Target.Count((x) =>
            {
                return HiringTracking.InterviewPassCheck(x.FirstInterviewResult);
            }));
            PhaseChart.Series[0].Points.Add(queryPoint);


            queryPoint = new DataPoint();
            queryPoint.SetValueXY("2ndPass", Target.Count((x) =>
            {
                return HiringTracking.InterviewPassCheck(x.SecondInterviewResult);
            }));
            PhaseChart.Series[0].Points.Add(queryPoint);


            queryPoint = new DataPoint();
            queryPoint.SetValueXY("3rdPass", Target.Count((x) =>
            {
                return HiringTracking.InterviewPassCheck(x.ThirdInterviewResult);
            }));
            PhaseChart.Series[0].Points.Add(queryPoint);

            queryPoint = new DataPoint();
            queryPoint.SetValueXY("OB", Target.Count((x) =>
            {
                return x.FinalStatus == HiringTracking.FinalStatusEnum.Onboard;
            }));
            PhaseChart.Series[0].Points.Add(queryPoint);
        }
Beispiel #31
0
        private void UpdateGraph(int selnum)
        {
            if (mainDB == null)
                return;

            if (mainDB[selnum] == null)
                return;

            int tgnum = mainDB[selnum].TGS.Count;

            Legend[] lgds = new Legend[tgnum];
            Series[] srsX = new Series[tgnum];
            Series[] srsY = new Series[tgnum];

            vchart.Legends.Clear();
            hchart.Legends.Clear();
            vchart.Series.Clear();
            hchart.Series.Clear();
            vchart.ChartAreas[0].AxisX.StripLines.Clear();
            hchart.ChartAreas[0].AxisX.StripLines.Clear();

            StripLine ln = new StripLine();
            ln.BorderColor = Color.Red;
            ln.IntervalOffset = m_TargetLimit * 1000;
            ln.BorderWidth = 4;
            vchart.ChartAreas[0].AxisY.StripLines.Add(ln);
            hchart.ChartAreas[0].AxisY.StripLines.Add(ln);

            vchart.ChartAreas[0].AxisY.Maximum = m_TargetLimit * 1000 + 5;
            hchart.ChartAreas[0].AxisY.Maximum = m_TargetLimit * 1000 + 5;

            switch (obstype)
            {
                case 0:
                    vchart.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss";
                    hchart.ChartAreas[0].AxisX.LabelStyle.Format = "HH:mm:ss";
                    break;
                case 1:
                    vchart.ChartAreas[0].AxisX.LabelStyle.Format = "DD HH:mm";
                    hchart.ChartAreas[0].AxisX.LabelStyle.Format = "DD HH:mm";
                    break;
                case 2:
                    vchart.ChartAreas[0].AxisX.LabelStyle.Format = "DD HH:mm";
                    hchart.ChartAreas[0].AxisX.LabelStyle.Format = "DD HH:mm";
                    break;
            }

            for (int i = 0; i < tgnum; i++)
            {
                TG tg = (TG)mainDB[selnum].TGS[i];

                //레전드 생성
                lgds[i] = new Legend(tg.m_ID);
                lgds[i].Name = tg.m_ID;

                lgds[i].BackColor = System.Drawing.Color.Transparent;
                lgds[i].Enabled = true;
                lgds[i].Font = new System.Drawing.Font("굴림", 8.25F, System.Drawing.FontStyle.Bold);
                lgds[i].IsTextAutoFit = false;
                lgds[i].DockedToChartArea = "ChartArea1";
                lgds[i].IsDockedInsideChartArea = true;

                vchart.Legends.Add(lgds[i]);
                hchart.Legends.Add(lgds[i]);

                //데이터 넣기
                srsX[i] = new Series();
                srsY[i] = new Series();

                int count = tg.Arr.Count;

                for (int j = 0; j < count; j++)
                {
                    COORD cd = (COORD)tg.Arr[j];
                    DataPoint dt = new DataPoint();
                    DataPoint dt2 = new DataPoint();

                    switch (obstype)
                    {
                        case 0:
                            dt.SetValueXY(string.Format("{0:00}:{1:00}:{2:00}", cd.hour, cd.min, cd.sec), cd.dx * 1000);
                            dt2.SetValueXY(string.Format("{0:00}:{1:00}:{2:00}", cd.hour, cd.min, cd.sec), cd.dy * 1000);
                            break;
                        case 1:
                            dt.SetValueXY(string.Format("{0:00} {1:00}:{2:00}", cd.day, cd.hour, cd.min), cd.dx * 1000);
                            dt2.SetValueXY(string.Format("{0:00} {1:00}:{2:00}", cd.day, cd.hour, cd.min), cd.dy * 1000);
                            break;
                        case 2:
                            dt.SetValueXY(string.Format("{0:00} {1:00}:{2:00}", cd.day, cd.hour, cd.min), cd.dx * 1000);
                            dt2.SetValueXY(string.Format("{0:00} {1:00}:{2:00}", cd.day, cd.hour, cd.min), cd.dy * 1000);
                            break;
                    }
                    srsX[i].Points.Add(dt);
                    srsY[i].Points.Add(dt2);

                }

                srsX[i].Name = lgds[i].Name + "번";
                srsX[i].ChartArea = "ChartArea1";
                srsX[i].ChartType = SeriesChartType.Line;
                srsX[i].Legend = lgds[i].Name;
                srsX[i].Color = lcolors[i];
                srsX[i].BorderWidth = 2;

                srsY[i].Name = lgds[i].Name + "번";
                srsY[i].ChartArea = "ChartArea1";
                srsY[i].ChartType = SeriesChartType.Line;
                srsY[i].Legend = lgds[i].Name;
                srsY[i].Color = lcolors[i];
                srsY[i].BorderWidth = 2;

                hchart.Series.Add(srsX[i]);
                vchart.Series.Add(srsY[i]);

            }
        }
        public void AddPoint(string label, object y, Color color)
        {
            if (chart1.Series.Count == 0)
                return;

            if (y.GetType() == typeof(double))
            {
                if (maxValue < (double)y)
                    maxValue = (double)y;

                // Prevent axis from hiding the label.
                chartArea.AxisY.Maximum = maxValue > 10 ? 1.3 * maxValue : 3.7 * maxValue;
            }

            DataPoint point = new DataPoint();

            point.IsValueShownAsLabel = true;

            point.SetValueXY(label, y);
            point.Color = color;

            // Prevent multiple add of an existing point.
            if (chart1.Series[0].Points.Contains(point))
                return;

            chart1.Series[0].Points.Add(point);
        }