Ejemplo n.º 1
0
        private void MChart_MouseMove(object sender, MouseEventArgs e)
        {
            int x = e.X;
            int y = e.Y;

            if (this.MCMM_LastX == x && this.MCMM_LastY == y)
            {
                return;
            }

            this.MCMM_LastX = x;
            this.MCMM_LastY = y;

            try
            {
                double aX = this.MChart.ChartAreas[0].AxisX.PixelPositionToValue(x);
                double aY = this.MChart.ChartAreas[0].AxisY.PixelPositionToValue(y);

                long sec = this.LastStartWeSec + LongTools.toInt(aX * 86400.0);
                sec = WeSec.WeSecToSec(sec);
                long dateTime = DateTimeToSec.toDateTime(sec);

                this.TTip.SetToolTip(
                    this.MChart,
                    Utils.DateTimeToString(dateTime) + "\n" +
                    aY
                    );
            }
            catch
            { }
        }
Ejemplo n.º 2
0
        private void LoadGraph(CurrencyPair cPair)
        {
            //CurrencyPairs.FxCollect();

            this.MChart.Series.Clear();
            this.MChart.Legends.Clear();
            this.MChart.ChartAreas.Clear();

            double minMid = double.MaxValue;
            double maxMid = double.MinValue;

            long currSec = DateTimeToSec.Now.getSec();

            Series srs = new Series();

            srs.ChartType = SeriesChartType.Line;
            srs.Color     = Color.OrangeRed;

            for (long sec = currSec - 86400L * 7L; sec <= currSec; sec += 30L)
            {
                double mid = cPair.GetPrice(DateTimeToSec.toDateTime(sec)).Mid;

                minMid = Math.Min(minMid, mid);
                maxMid = Math.Max(maxMid, mid);

                srs.Points.AddXY((sec - currSec) / 86400.0, mid);
            }
            this.MChart.Series.Add(srs);

            ChartArea ca = new ChartArea();

            {
                double METER_SCALE = 1000.0;

                minMid = (long)(minMid * METER_SCALE) / METER_SCALE;
                maxMid = ((long)(maxMid * METER_SCALE) + 1) / METER_SCALE;
            }

            ca.AxisX.Minimum  = -7.0;
            ca.AxisX.Maximum  = 0.0;
            ca.AxisX.Interval = 1.0;
            ca.AxisY.Minimum  = minMid;
            ca.AxisY.Maximum  = maxMid;

            //ca.BorderWidth = 0;

            this.MChart.ChartAreas.Add(ca);

            //this.MChart.Margin = new Padding(0);
            //this.MChart.BorderlineDashStyle = ChartDashStyle.NotSet;
            //this.MChart.BorderlineWidth = 0;

            this.Text = Program.APP_TITLE + " - " + cPair.Code;
        }
Ejemplo n.º 3
0
        private void DoAltCommand(string command, bool keepAxY = false)
        {
            try
            {
                string        args     = this.Args.Text;
                List <string> tokens   = StringTools.tokenize(args, ":");
                long          dateTime = long.Parse(tokens[1]);
                long          sec      = DateTimeToSec.toSec(dateTime);
                long          weSec    = WeSec.SecToWeSec(sec);

                switch (command)
                {
                case "戻る":
                {
                    long secBound = this.StringToSec(tokens[3]);

                    weSec -= secBound / 4;
                }
                break;

                case "進む":
                {
                    long secBound = this.StringToSec(tokens[3]);

                    weSec += secBound / 4;
                }
                break;

                case "Y-拡大":
                {
                    expandAxY(1.0 / 1.5);
                    keepAxY = true;
                }
                break;

                case "Y-縮小":
                {
                    expandAxY(1.5);
                    keepAxY = true;
                }
                break;

                case "拡大":
                {
                    long secInterval = this.StringToSec(tokens[2]);
                    long secBound    = this.StringToSec(tokens[3]);

                    secInterval /= 2;
                    secBound    /= 2;

                    // 調整 TODO
                    {
                        if (secBound % secInterval != 0)
                        {
                            secBound /= secInterval;
                            secBound *= secInterval;
                        }
                    }

                    tokens[2] = this.SecToString(secInterval);
                    tokens[3] = this.SecToString(secBound);
                }
                break;

                case "縮小":
                {
                    long secInterval = this.StringToSec(tokens[2]);
                    long secBound    = this.StringToSec(tokens[3]);

                    secInterval *= 2;
                    secBound    *= 2;

                    tokens[2] = this.SecToString(secInterval);
                    tokens[3] = this.SecToString(secBound);
                }
                break;

                default:
                    throw null;
                }

                sec            = WeSec.WeSecToSec(weSec);
                dateTime       = DateTimeToSec.toDateTime(sec);
                tokens[1]      = "" + dateTime;
                args           = string.Join(":", tokens);
                this.Args.Text = args;

                executeArgs(keepAxY);
            }
            catch
            { }
        }
Ejemplo n.º 4
0
 public static long WeSecToDateTime(long weSec)
 {
     return(DateTimeToSec.toDateTime(WeSecToSec(weSec)));
 }