0
votes

I want to use zedgraph in asp.net 4. but I get the erros below:

System.IO.DirectoryNotFoundException:

Could not find a part of the path C:\Users\stn-1\Desktop\ZedGraphWebAp1_CompiledSite8 \ZedGraphImages\ZedGraphWeb1fc6eb2c0-023a-4818-bff9-9c957971af4b.png. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at ZedGraph.Web.ZedGraphWeb.Render(HtmlTextWriter output)

I use the code below :

 protected void ZedGraphWeb1_RenderGraph(ZedGraphWeb webObject, System.Drawing.Graphics g, MasterPane pane)
{
    GraphPane myPane = pane[0];

    myPane.Title.Text = "Title";
    myPane.XAxis.Title.Text = "X axis label";
    myPane.YAxis.Title.Text = "Y axis label";

    PointPairList list1 = new PointPairList();

    for (int i = 0; i < 10; i++)
    {
        double x = Convert.ToDouble(i);
        double y = x * x;
        list1.Add(x, y);
    }

    string textForLegend = "x-squared";
    myPane.CurveList.Clear();
    LineItem myCurve = myPane.AddCurve(textForLegend,
        list1, Color.Red, SymbolType.Diamond);
    myCurve.Symbol.IsVisible = true;

}
1

1 Answers

3
votes

The reason is that zedgraph don't create a folder name "ZedGraphImages" automatically in root folder... you should create it manually...