Ejemplo n.º 1
0
        public void SetChart(BalanceViewType viewType, string name)
        {
            if (InvokeRequired)
            {
                SetChartCallback d = new SetChartCallback(SetChart);
                Invoke(d, new object[] { viewType, name });
            }
            else
            {
                try
                {
                    //LogManager.AddLogMessage(Name, "SetChart", "viewType=" + viewType + " | " + name, LogManager.LogMessageType.EXCEPTION);
                    switch (viewType)
                    {
                    case BalanceViewType.balance:
                        SetSymbolChart(name);
                        break;

                    case BalanceViewType.exchange:
                        SetExchangeChart(name);
                        break;

                    case BalanceViewType.symbol:
                        SetSymbolChart(name);
                        break;

                    case BalanceViewType.orders:
                        SetOrdersChart();
                        break;

                    case BalanceViewType.forks:
                        SetForksChart();
                        break;

                    default:
                        AddLogMessage(Name, "SetChart", "UNDEFINED viewType=" + viewType, LogMessageType.OTHER);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    AddLogMessage(Name, "SetChart", ex.Message, LogMessageType.EXCEPTION);
                }
            }
        }
Ejemplo n.º 2
0
 private void AddTempPoint(string text)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.chart1.InvokeRequired)
     {
         SetChartCallback d = new SetChartCallback(AddTempPoint);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         if (text.Length > 0)
         {
             this.chart1.Series[0].Points.Add(double.Parse(text));
         }
     }
 }
Ejemplo n.º 3
0
 private void SetChart(double X, double Y)
 {
     //MessageBox.Show(X.ToString() + " " + Y.ToString());
     //X /= (int)1492158000;
     //X *= 10;
     //MessageBox.Show(X.ToString() + " ** " + Y.ToString());
     if (this.InvokeRequired)
     {
         SetChartCallback d = new SetChartCallback(SetChart);
         this.Invoke(d, new object[] { X, Y });
     }
     else
     {
         this.chart1.Series["EDA"].Points.AddXY(FromUnixTime(X), Y);
         this.chart1.ChartAreas["ChartArea1"].AxisX.Minimum = FromUnixTime(X).AddSeconds(-3).ToOADate();
         this.chart1.ChartAreas["ChartArea1"].AxisX.Maximum = FromUnixTime(X).AddSeconds(1).ToOADate();
         this.chart1.ChartAreas["ChartArea1"].AxisY.Minimum = -1;
         this.chart1.ChartAreas["ChartArea1"].AxisY.Maximum = 5;
     }
 }
Ejemplo n.º 4
0
        public static void SetChart(Form form, Chart chart, List <KeyValuePair <double, double> > values, double xMin, double xMax, double yMax)
        {
            if (values == null)
            {
                return;
            }
            if (ProblemFound)
            {
                return;
            }

            try
            {
                if (chart.InvokeRequired)
                {
                    SetChartCallback d = new SetChartCallback(SetChart);
                    if (form.IsDisposed)
                    {
                        return;
                    }
                    form.Invoke(d, new object[] { form, chart, values, xMin, xMax, yMax });
                }
                else
                {
                    chart.ChartAreas[0].AxisX.Minimum = xMin;
                    chart.ChartAreas[0].AxisX.Maximum = xMax;

                    chart.ChartAreas[0].AxisY.Maximum = yMax;

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

                    foreach (var value in values)
                    {
                        chart.Series["Score"].Points.AddXY(value.Key, value.Value);
                    }
                }
            }
            catch (Exception) { ProblemFound = true; }
        }