将散点图保存为C#中的图像

时间:2016-06-05 21:01:07

标签: c# image graph bitmap scatter

我正在 c#program 中绘制 SQL数据中的一些散点图。我想在填充时自动保存这些图表。我有以下代码保存Jpeg文件,但是当我打开它们时,它们为空。我一次绘制多个图表。

感谢任何帮助。

public partial class XYplotForm : Form
    {
        public XYplotForm()
        {
            InitializeComponent();

        }
        public void Plot(Double[] freq, Double[] amp, Double[] bw, string name)
        {
            scatterGraph1.PlotXY(freq, amp);
            tbName.Text = name;

            Bitmap image = new Bitmap(scatterGraph1.Width, scatterGraph1.Height);
            Rectangle target_bounds = default(Rectangle);
            target_bounds.Width = scatterGraph1.Width;
            target_bounds.Height = scatterGraph1.Height;
            target_bounds.X = 0;
            target_bounds.Y = 0;
            scatterGraph1.DrawToBitmap(image, target_bounds);
            string filename = "C:\\Graph\\" + name + ".Jpeg";
            image.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);



            }


        }


    }

1 个答案:

答案 0 :(得分:0)

public void addByName(String name)
{
    List<WebElement> rows = driver.findElements(By.tagName("tr"));
    for (WebElement row : rows)
    {
        List<WebElement> cells = row.findElements(By.tagName("td"));
        if (cells.get(1).getText().equals(name))
        {
            cells.get(3).findElement(By.linkText("Add Quote")).click();
            return;
        }
    }
}