/// <summary> /// チャートコンストラクタ切り替え /// </summary> /// <param name="constractor"></param> public void Arrange(ChartConstructor constractor) { if ((constractor != null) && (title != null)) { chart = ChartFactory.CreateChart(); chart.AxisPointed += Chart_AxisPointed; constractor.ConstractChart(chart, title); chart.Resize(ClientSize.Width, ClientSize.Height); Invalidate(ClientRectangle); } }
/// <summary> /// タイトル設定 /// </summary> /// <param name="constractor">チャート構築アルゴリズム</param> public void Arrange(DB.Title title, ChartConstructor constractor) { this.title = title; if (constractor != null) { chart = ChartFactory.CreateChart(); chart.AxisPointed += Chart_AxisPointed; constractor.ConstractChart(chart, title); chart.Resize(ClientSize.Width, ClientSize.Height); //chart.AxisPointed += (s, a) => Console.WriteLine($"Logical {a.X}, {a.Y1}, {a.Y2}"); Invalidate(ClientRectangle); } }
/// <summary> /// 保存時のサイズ指定 /// </summary> /// <param name="f"></param> /// <param name="w"></param> /// <param name="h"></param> public void SaveImage(ChartConstructor constractor, string f, int w, int h) { //今表示している内容に悪影響を及ぼさないようにゼロから構築して保存 var bmp = new Bitmap(w, h); var d = new GDIDrawContext(); var g = Graphics.FromImage(bmp); var c = ChartFactory.CreateChart(); constractor.ConstractChart(c, title); c.Resize(w, h); d.ClientRect = new RectangleF(0, 0, w, h); d.PaintHandler(g); c.Draw(d); bmp.Save(f, System.Drawing.Imaging.ImageFormat.Png); }