等到到

来源:互联网 发布:天下3奕剑男号捏脸数据 编辑:程序博客网 时间:2024/04/29 13:48

7,587,462 members and growing! (34,129 online) Email Password Remember me? Lost password? Home Articles Chapters and Sections Search Latest Articles Latest Tips/Tricks Top Articles Beginner Articles Technical Blogs Post an Article Post Tip & Trick Post your Blog Posting/Update Guidelines Article Competition Questions & Answers Ask a Question about this article Quick Answers Ask a Question View Unanswered Questions View All Questions... C# questions ASP.NET questions VB.NET questions C++ questions C#3.0 questions Programming Discussions All Message Boards... Application Lifecycle> Design and Architecture Running a Business Sales / Marketing Collaboration / Beta Testing Work & Training Issues ASP.NET C / C++ / MFC> ATL / WTL / STL Managed C++/CLI C# Database Hardware & Devices> System Admin Hosting and Servers Java .NET Framework Mobile Sharepoint Silverlight / WPF Visual Basic Web Development> CSS Javascript PHP Site Bugs / Suggestions Other Languages> General Indian Topics General Chinese Topics Learning Zones The Commerce ZoneThe Mobile ZoneThe Cloud ZoneThe Parallelism ZoneThe WPF / Silverlight ZoneThe .NET ZoneThe SQL ZoneWhitePapers / Webcasts Solutions Center Features Who's Who CodeProject MVPs Company Listings Component & Service Catalog Competitions News Daily Insider Newsletter archive Press Releases Surveys CodeProject Stuff CodeProject VS Addin Help! What is 'The Code Project'? General FAQ Post a Question Bugs and Suggestions Site Directory Advertise with us About Us The Lounge The Lounge Clever Code Hall of Shame The Soapbox Search within: Articles Quick Answers Messages Product Catalog » Web Development » Charts, Graphs and Images » Images and multimedia Licence CPOL First Posted 26 Feb 2008 Views 58,233 Bookmarked 124 times Graph Library By Anoop Unnikrishnan | 10 Apr 2008 .NET2.0C#2.0C#ASP.NETWindows.NETDevDesignIntermediate This article addresses the construction of a simple graph library using C#. See Also More like this More by this author Print Article Twitter Digg Facebook Del.icio.us Reddit Stumbleupon Newsvine Technorati Mr. Wong Yahoo! Google Windows Live Send as Email Add to your CodeProject bookmarks Discuss this article 12 Report this article as inappropriate Article Browse Code Stats Revisions 4.71 (58 votes) 1 2 3 4 5 Sponsored Links Download source - 3.24 KB Download demo project - 27.83 KB Download Version2 Library + Demo - 20.04 KB Introduction Graphics within the .NET Framework is a powerful feature that can be adapted to a wide range of purposes. Here I have developed a class to demonstrate the use of graphics to create graphs like: Bar graph Pie graph Line graph Using the Code The attached project contains a file named DrawGraph.cs, which is the generic library to generate graphs. The methods in this library generate graphs like the Single dimension Bar graph, 3D Bar graph, Single dimension Pie graph, 3D Pie graph and Line graph. All the graphs are generated in bitmap format. The code below demonstrates the use of this library in a Windows application: Collapse | Copy Code // Values used to create graph string [] keyValue=new string[ui_lbx_DataKey.Items.Count]; float[] values = new float[ui_lbx_DataKey.Items.Count]; for (int i = 0; i < ui_lbx_DataKey.Items.Count; i++) { keyValue[i] = ui_lbx_DataKey.Items[i].ToString(); values[i] = float.Parse(ui_lbx_DataValue.Items[i].ToString()); } //Include namespace System.Anoop.Graph and initiaze the //bargraph object with values,label on x & y axis, font format and alpha DrawGraph bargraph = new DrawGraph(keyValue, values, ui_txt_xlabel.Text, ui_txt_ylabel.Text, "Courier", 255); //Generating graph and assigning it to respective picture box p1.Image = bargraph.DrawBarGraph(); p2.Image = bargraph.Draw3dBarGraph(); p3.Image = bargraph.DrawPieGraph(); p4.Image = bargraph.Draw3DPieGraph(); //Generating Line graph DrawGraph bargraph1 = new DrawGraph(keyValue, values, ui_txt_xlabel.Text, ui_txt_ylabel.Text, "Courier", 255); p5.Image = bargraph1.DrawLineGraph();The code below demonstrates the use of this library in an ASP.NET application: Collapse | Copy Code DrawGraph bargraph = new DrawGraph(keyValue, values, "Financial Year","Profit", "Courier", 255); //Generating graph and assigning it to respective imagebox System.Drawing.Bitmap b = new System.Drawing.Bitmap(400, 400); b = bargraph.DrawLineGraph(); b.Save(Server.MapPath("Graph")+"//LineGraph.bmp"); Image1.ImageUrl =".//Graph//LineGraph.bmp"; System.Drawing.Bitmap b1 = new System.Drawing.Bitmap(400, 400); b1 = bargraph.DrawPieGraph(); b1.Save(Server.MapPath("Graph") + "//PieGraph.bmp"); Image2.ImageUrl = ".//Graph//PieGraph.bmp"; System.Drawing.Bitmap b2 = new System.Drawing.Bitmap(400, 400); b2 = bargraph.Draw3DPieGraph(); b2.Save(Server.MapPath("Graph") + "//3DPieGraph.bmp"); Image3.ImageUrl = ".//Graph//3DPieGraph.bmp"; System.Drawing.Bitmap b3 = new System.Drawing.Bitmap(400, 400); b3 = bargraph.Draw3dBarGraph(); b3.Save(Server.MapPath("Graph") + "//3dBarGraph.bmp"); Image4.ImageUrl = ".//Graph//3dBarGraph.bmp";Code There are a few imports made at the start of the class. Those imports are included to work with image files. Collapse | Copy Code using System; using System.Collections.Generic; using System.Text; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.Drawing;Now come the global variables: Collapse | Copy Code string[] valueLabels; float[] values; string xLabel; //Label displayed on x axis string yLabel; //Label displayed on y axis string fontFormat; //format for labels int alpha; //alpha for graph List colorList; //Dark colors onlyThese global variables are being initialized using the constructor: Collapse | Copy Code public DrawGraph(string[] valueLabels,float[] values,string xLabel,string yLabel,string fontFormat,int alpha) { this.valueLabels = valueLabels; this.values = values; this.xLabel = xLabel; this.yLabel = yLabel; this.alpha = alpha; this.fontFormat=fontFormat; InitColorList(); }Here InitColorList() is a method to initialize colorList with dark colors. Collapse | Copy Code //Initiatialize color list with dark color's private void InitColorList() { colorList = new List(); foreach (string colorName in Enum.GetNames(typeof(System.Drawing.KnownColor))) { //Check if color is dark if (colorName.StartsWith("D") == true) { colorList.Add(System.Drawing.Color.FromName(colorName)); } } } //Embed axis for bar graphsIn this class we have some more private methods like EmbedAxis(), EmbedXPanel() and EmbedXLinePanel(). These are used to create axes, create x-axis value mapping with color and create x-axis value mapping to line color respectively. Collapse | Copy Code Bitmap EmbedAxis(Bitmap graph,bool showAxis) { Bitmap backgroundCanvas = new Bitmap(400, 300); Bitmap yLabelImage = new Bitmap(15,200); Graphics graphicsBackImage = Graphics.FromImage(backgroundCanvas); Graphics objGraphic2 = Graphics.FromImage(graph); Graphics objGraphicY = Graphics.FromImage(yLabelImage); Pen blackPen = new Pen(Color.Black, 2); //Paint the graph canvas white SolidBrush whiteBrush = new SolidBrush(Color.White); graphicsBackImage.FillRectangle(whiteBrush,0, 0, 400, 300); if (showAxis == true) { //draw lable for y axis StringFormat sf = new StringFormat(StringFormatFlags.DirectionVertical); Font f = new Font(fontFormat,8); SizeF sizef = objGraphicY.MeasureString("<- " + yLabel, f, Int32.MaxValue,sf); RectangleF rf = new RectangleF(0, 0, sizef.Width, sizef.Height); objGraphicY.DrawRectangle(Pens.Transparent,rf.Left, rf.Top, rf.Width, rf.Height); objGraphicY.DrawString((yLabel.Length>0?"<-":"") + yLabel, f, Brushes.Black, rf, sf); graphicsBackImage.DrawString(xLabel +(xLabel.Length>0?" ->":""), f, Brushes.Black, 30, 235); graphicsBackImage.DrawLine(blackPen,new Point(0, 230), new Point(230, 230)); graphicsBackImage.DrawLine(blackPen, new Point(20, 20), new Point(20, 250)); } graphicsBackImage.DrawImage(graph, 25, 25); if (showAxis == true) { graphicsBackImage.DrawImage(yLabelImage, 0, 90); } return (backgroundCanvas); } //Embed x Panel Bitmap EmbedXPanel(Bitmap graph) { Bitmap xPanel = new Bitmap(100, 200); Graphics objGraphicPanel = Graphics.FromImage(xPanel); Graphics graphicGraph = Graphics.FromImage(graph); for (int i = 0, x = 10; i (tempValue); highestValue = tempValue[values.Length - 1]; //Generate bar for each value for (int i = 0, x = 10; i < values.Length; i++) { float barHeight; //hight of the bar barHeight = (values[i] / highestValue) * 190; //Draw the bar SolidBrush brush = new SolidBrush(Color.FromArgb(alpha, colorList[i])); graphicGraph.FillRectangle(brush,x, 194 - barHeight, 10, barHeight); //x axis spacing by 20 x += 20; } // Increase the size of the canvas and draw axis objgraph = EmbedAxis(objgraph, true); //Draw the key-value pair with repective color code objgraph = EmbedXPanel(objgraph); return (objgraph); }Drawing a 3D Bar Graph is similar to the above code of bar graphs except that we need to perform some additional tasks like: Draw a shadow. Draw a white line at the bottom of the graph to hide the shadow. Collapse | Copy Code public Bitmap Draw3dBarGraph() { Bitmap objgraph = new Bitmap(200, 200); //Canvas for graph Bitmap objXValuePanel = new Bitmap(100,200); //Canvas to display x-axis values Graphics graphicGraph = Graphics.FromImage(objgraph); Graphics graphicXValuePanel = Graphics.FromImage(objXValuePanel); //Paint the graph canvas white SolidBrush whiteBrush = new SolidBrush(Color.White); graphicGraph.FillRectangle(whiteBrush,0, 0, 200, 200); float highestValue; //Highest value in the values array //Get the highest value float[] tempValue = new float[values.Length]; for (int j = 0; j < values.Length; j++) { tempValue[j] = values[j]; } Array.Sort(tempValue); highestValue = tempValue[values.Length - 1]; //Generate bar for each value for (int i = 0, x = 10; i < values.Length; i++) { SolidBrush brush = new SolidBrush(Color.FromArgb(alpha,colorList[i])); float barHeight; //hight of the bar barHeight = (values[i] / highestValue)* 190; //Draw continuous shade for 3D effect float shadex = x + 10; float shadey = 194 - ((int)barHeight) + 10; for (int iLoop2 = 0; iLoop2 < 10; iLoop2++) { graphicGraph.FillRectangle(brush, shadex - iLoop2, shadey - iLoop2, 10, barHeight); } //Draw bar graphicGraph.FillRectangle(new HatchBrush(HatchStyle.Percent50, brush.Color), x, 194 - barHeight, 10, barHeight); //Increment the x position x += 20; } //Mask bottom with a white line Pen whitePen = new Pen(Color.White, 10); graphicGraph.DrawLine(whitePen,new Point(10, 200), new Point(230, 200)); //Increase the size of the canvas and draw axis objgraph = EmbedAxis(objgraph, true); //Draw the key-value pair with repective color code objgraph = EmbedXPanel(objgraph); return (objgraph); }To draw a Pie graph following the below algorithm: First prepare a white canvas of dimensions 200 X 200. Calculate the sum of all x-values [ x-axis values ]. Initialize the start angle of the pie to 0 degrees. For each value... Calculate sweepAngle using the formula: sweep angle= (x value * 360) / sum of all x values. Draw the pie. Increase the start angle with the sweep angle. Place the pie graph on an enlarged the canvas using EmbedAxis(), with showAxis flag set to false. Draw the x-value mapping to the color using EmbedXPanel(). Collapse | Copy Code public Bitmap DrawPieGraph() { Bitmap objgraph = new Bitmap(200, 200); Graphics graphicGraph = Graphics.FromImage(objgraph); //Create location and size of ellipse. int x = 0; int y = 0; int width = 200; int height = 100; //Create start and sweep angles. float sweepAngle = 0; float startAngle = 0; float total = 0; for (int i = 0; i < values.Length; i++) { total += values[i]; } for (int i = 0; i < values.Length; i++) { SolidBrush objBrush = new SolidBrush(colorList[i]); sweepAngle = (values[i] * 360) / total; graphicGraph.SmoothingMode = SmoothingMode.AntiAlias; graphicGraph.FillPie(objBrush, x, y, width, height, startAngle, sweepAngle); startAngle += sweepAngle; } //Increase the size of the canvas in which the graph resides objgraph = EmbedAxis(objgraph, false); //Draw the key-value pair with repective color code objgraph = EmbedXPanel(objgraph); return (objgraph); }Drawing a 3D Pie is similar to a Pie graph with an additional task: drawing shadows. Collapse | Copy Code Bitmap Draw3DPieGraph() { Bitmap objgraph = new Bitmap(200, 200); Graphics graphicGraph = Graphics.FromImage(objgraph); //Create location and size of ellipse. int x =0; int y = 0; int width = 200; int height = 100; //Find the sum of all values float total = 0; for (int i = 0; i < values.Length; i++) { total += values[i]; } //When loop=0: Draw shadow //loop=1: Draw graph for (int loop = 0; loop < 2; loop++) { //Create start and sweep angles float sweepAngle = 0; float startAngle = 0; //Draw pie for each value for (int i = 0; i < values.Length; i++) { SolidBrush objBrush = new SolidBrush(colorList[i]); sweepAngle = (values[i] * 360) / total; graphicGraph.SmoothingMode = SmoothingMode.AntiAlias; if (loop == 0) { for (int iLoop2 = 0; iLoop2 < 10; iLoop2++) graphicGraph.FillPie(new HatchBrush(HatchStyle.Percent50,objBrush.Color), x, y + iLoop2, width, height, startAngle, sweepAngle); } else { graphicGraph.FillPie(objBrush, x, y, width, height, startAngle, sweepAngle); } startAngle += sweepAngle; } } //Increase the size of the canvas in which the graph resides objgraph = EmbedAxis(objgraph, false); //Draw the key-value pair with repective color code objgraph = EmbedXPanel(objgraph); return (objgraph); }To draw a Line graph, we use the same formula of bar graph to calculate the height. Once the points are marked, just join them using lines with different colors. x-Panel has to be drawn using EmbedXLinePanel(). Collapse | Copy Code //Generate Line graph public Bitmap DrawLineGraph() { Bitmap objgraph = new Bitmap(200, 200); //Canvas for graph Graphics graphicGraph = Graphics.FromImage(objgraph); //Paint the graph canvas white SolidBrush whiteBrush = new SolidBrush(Color.White); graphicGraph.FillRectangle(whiteBrush,0, 0, 200, 200); int highestValue; //Highest value in the values array //Get the highest value int[] tempValue = new int[values.Length]; for (int j = 0; j < values.Length;j++) { tempValue[j] = (int)values[j]; } Array.Sort(tempValue); highestValue = tempValue[values.Length - 1]; int[,] points = new int[values.Length, 2]; //Generate bar for each value for (int i = 0, x = 10; i < values.Length; i++) { decimal barHeight; //height of the bar barHeight = (decimal)(values[i] / highestValue * 190); points[i, 0] = x; barHeight = 194 - barHeight; points[i, 1] = (int)Decimal.Round(barHeight,0); Font f = new Font(fontFormat, 8); graphicGraph.FillEllipse(Brushes.Black, points[i,0]-2, points[i, 1]-2, 5, 5); graphicGraph.DrawString(values[i].ToString(), f, Brushes.Black,new Point(points[i, 0]-14, points[i, 1]-5)); x += 20; } for (int i = 1; i < values.Length; i++) { Point startPoint = new Point(points[i - 1, 0], points[i - 1, 1]); Point endPoint = new Point(points[i, 0], points[i, 1]); SolidBrush brush = new SolidBrush(colorList[i]); Pen colorPen = new Pen(brush, 2); graphicGraph.DrawLine(colorPen, startPoint, endPoint); } objgraph = EmbedAxis(objgraph,true); objgraph = EmbedXLinePanel(objgraph); return (objgraph); }History 27 February, 2008 -- Original version posted 27 March, 2008 -- Introduced Bar Line Graph License This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL) About the Author Anoop Unnikrishnan Software Developer India Member Anoop Unnikrishnan is associated with a CMM Level 5 Company. He has done his Bachelor of Engineering in Information Science. His certifications include OCA,IBM SOA Associate, MCAD, MCTS and MCPD. He is working on .NET since first Beta versions. He has recently published his book "Start Programming with C#". Grab a copy from www.pothi.com/pothi/book/anoop-unnikrishnan-start-programming-c Anoop can be reached : anoopukrish@gmail.com Article TopSign Up to vote for this article Add a reason or comment to your vote: x Comments and Discussions You must Sign In to use this message board. (secure sign-in) FAQ Noise Tolerance Very HighHighMediumLowVery Low Layout NormalExpand Posts onlyExpand Posts & RepliesThread ViewNo JavascriptNo JS + Preview Per page 102550 Msgs 1 to 10 of 12 (Total in Forum: 12) (Refresh) FirstPrevNext My vote of 1 whizMos 2:01 7 Sep '10 very poor Sign In·View Thread·Link 1.00/5 (2 votes) Re: My vote of 1 Lloyd Atkinson 11:09 18 Dec '10 You complete idiot. -------------------------------------------------------------------------------- See if you can crack this: fb29a481781fe9b3fb8de57cda45fbef The unofficial awesome history of Code Project's Bob! "People demand freedom of speech to make up for the freedom of thought which they avoid." Sign In·View Thread·Link Fix for colors avivd 5:33 3 Mar '09 sometimes i get a white color, because it is the 'desktop' color. one should apply a fix at DrawGraph.cs, line 70: change: colorName.StartsWith("D") to: colorName.StartsWith("Dark") Besides that, it's a Good one! thanks to the author! Sign In·View Thread·Link OHLC - Adding an extra line Alex Tostevin 23:01 17 Jun '08 Hi guys, First of all, thank you - this is a fantastic component. I'm having a spot of trouble adding an extra line to an OHLC chart. For instance, the OHLC chart displays values for day1, day2, day3 and day4 (which works perfectly) and I would like to draw a straight line from day1 to day3. What I am finding is that the line's x-axis does not tie up with the OHLC's (i.e. the line does show up, but not where it should and it is scaled incorrectly). The y-axis of the line does tie up with the y-axis of the OHLC chart which is fine. The x-axis of the OHLC is a date in ordinal format. I have tried setting the line's x-axis points as equal to those for day1 and day3 but this doesn't seem to work. Nor does allocating them "1.0" or "3.0". I have also tried allocating them a number equal to the relevant xdate number... I must say that I am completely stumped and would be grateful for your assistance. I have tried searching these forums and those at sourceforge, but I can't seem to find anyone experiencing this problem. My code is below (sorry if it appears confusing - I am self taught and my coding is not always completely logical). In summary, the code pulls the values for the OHLC chart from a database for a period going back a number of days. This part works correctly. The part I have having a problem with I have flagged below. Is this something I can fix with XAxis.Scale? I can't seem to figure this part out. Thanks Alex zg1.GraphPane.CurveList.Clear() zg1.GraphPane.GraphObjList.Clear() Dim HowFarBack As Integer = HFBTxt.Text 'This is the number of days to pull down data for Dim ds As New DataSet Dim da As SqlDataAdapter Dim sql As String con.Open() sql = "SELECT * FROM " & "Data1" & " ORDER BY Date Asc" da = New SqlDataAdapter(sql, con) da.Fill(ds, "Consider") con.Close() 'Info from 25 days Dim OpenZ(HowFarBack) Dim CloseZ(HowFarBack) Dim HighZ(HowFarBack) Dim LowZ(HowFarBack) Dim DateZ(HowFarBack) 'As New XDate Dim ECT As Integer = 0 ECT = ds.Tables("Consider").Rows.Count Dim N As Integer = 0 Dim M As Integer = 1 For N = HowFarBack To 1 Step -1 'ECT - 26 To ECT - 2 OpenZ(M) = ds.Tables("Consider").Rows(ECT - N).Item("Open") CloseZ(M) = ds.Tables("Consider").Rows(ECT - N).Item("Close") HighZ(M) = ds.Tables("Consider").Rows(ECT - N).Item("High") LowZ(M) = ds.Tables("Consider").Rows(ECT - N).Item("Low") OpenZ(M) = ds.Tables("Consider").Rows(ECT - N).Item("Open") DateZ(M) = ds.Tables("Consider").Rows(ECT - N).Item("Date") M = M + 1 Next N Dim myPane = zgc.GraphPane Dim DatY As Date = DateZ(1) Dim DiffBwDate As TimeSpan Dim TempD Dim DDate As Double ' Set the title and axis labels myPane.Title.Text = "OHLC Chart Demo" myPane.XAxis.Title.Text = "Date" myPane.YAxis.Title.Text = "Value" Dim spl = New StockPointList() 'First day is jan 1st Dim xDate As New XDate(DatY.Year, DatY.Month, DatY.Day) 'Copy of xDate Dim xDate2 As New XDate(DatY.Year, DatY.Month, DatY.Day) Dim list1 As New PointPairList() Dim i As Integer, x As Double, x1 As Double, x2 As Double, x3 As Double x = 0 'This routine puts data into stockpointlist For i = 1 To M - 1 x = xDate.XLDate If i = 1 Then x1 = x If i = 2 Then x2 = x If i = 3 Then x3 = x Dim pt As New StockPt(x, HighZ(i), LowZ(i), OpenZ(i), CloseZ(i), 100000) If i <> 1 And i <> (M - 1) Then If CloseZ(i) > CloseZ(i - 1) Then pt.ColorValue = 2 Else pt.ColorValue = 1 End If End If spl.Add(pt) If i <>1 and i<> (M - 1) Then DatY = DateZ(i + 1) DiffBwDate = DatY.Subtract(DateZ(i)) TempD = DiffBwDate.Days DDate = TempD xDate.AddDays(DDate) End If Next i Dim myFill As New Fill(Color.Red, Color.Blue) myFill.Type = FillType.GradientByColorValue myFill.SecondaryValueGradientColor = Color.Empty myFill.RangeMin = 1 myFill.RangeMax = 2 Dim myCurve As OHLCBarItem myCurve = myPane.addohlcbar("trades", spl, Color.Empty) myCurve.Bar.GradientFill = myFill myCurve.Bar.IsAutoSize = True 'THIS IS THE PROBLEM AREA 'Add data to pointpairlist list1.Add(x1, 5000) list1.Add(x2, 5500) list1.Add(x3, 6000) 'Add line Dim myCurve2 As LineItem = myPane.AddCurve("Correction", list1, Color.Green, SymbolType.Circle) 'Make the symbols opaque by filling them with white myCurve2.Symbol.Fill = New Fill(Color.White) myCurve2.IsX2Axis = True 'END PROBLEM AREA DatY = DateZ(1) ' Use DateAsOrdinal to skip weekend gaps myPane.XAxis.Type = AxisType.DateAsOrdinal 'Date ' 'myPane.XAxis.Scale.Min = New XDate(DatY.Year, DatY.Month, DatY.Day) '(2006, 1, 1) '(DatY.Year, DatY.Month, DatY.Day) '(2006, 1, 1) ' pretty it up a little myPane.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F) myPane.Fill = New Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0F) myPane.Title.FontSpec.Size = 20.0F myPane.XAxis.Title.FontSpec.Size = 18.0F myPane.XAxis.Scale.FontSpec.Size = 16.0F myPane.YAxis.Title.FontSpec.Size = 18.0F myPane.YAxis.Scale.FontSpec.Size = 16.0F ' Tell ZedGraph to calculate the axis ranges zgc.AxisChange() zgc.Invalidate() Sign In·View Thread·Link Re: OHLC - Adding an extra line Alex Tostevin 6:38 18 Jun '08 Sorry - this has appeared in the wrong forum... not sure why. Sign In·View Thread·Link GDI+ Error Member 2223359 0:22 21 May '08 Hi Anoop, first of all thanks for the good work on the article and code. I am currently getting the following error when using [Bmp].Save([Filepath] + [Filename]): System.Runtime.InteropServices.ExternalException: A generic error in GDI+. I scoured the web and found the following answer: http://support.microsoft.com/?id=514675 After implementing the above I still get the error. The posts on the ASP.NET official website suggests that it is a permissions issue but after setting write permissions on the folder for all account the error still occurs. Could you please lend a hand? Mindfull you must be young jedi. Sign In·View Thread·Link 1.00/5 (1 vote) Good Job Shibuv 6:17 8 May '08 Good Job Anoop. Nice Work A suggestion - horizontal bar graph in next version. Shibu Sign In·View Thread·Link Very good jomet 2:32 11 Apr '08 Thanks for your very nice article. can i export this graphs to excel. Sign In·View Thread·Link Re: Very good Anoop Unnikrishnan 6:20 11 Apr '08 Please check out this article http://www.dotnetspider.com/code/C-383-Programmatically-embed-picture-inside-an-Excel.aspx Sign In·View Thread·Link Tought is was a graph library... axelriet 18:26 10 Apr '08 But it's a chart library, very different. Sign In·View Thread·Link 2.50/5 (4 votes) Last Visit: 19:00 31 Dec '99 Last Update: 3:45 2 Mar '11 12 Next » General News Question Answer Joke Rant Admin link | Privacy | Terms of Use | Mobile Last Updated: 10 Apr 2008 Copyright 2008 by Anoop Unnikrishnan Everything else Copyright © CodeProject, 1999-2011 Web22 | Advertise on the Code Project Resco MobileApp Studio Resco MobileApp Studio is a Microsoft Visual... www.resco.net Data Dynamics Reports for Windows Forms, ASP.NET Data Dynamics Reports for Business Reporting... www.gcpowertools.com ActiveReports for Silverlight, Windows Forms, ASP.NET ActiveReports by GrapeCity is an award-winning... www.gcpowertools.com See Also... A 2D data visualisation class A comprehensive set of classes for displaying... A flexible charting library for .NET Looking for a way to draw 2D line graphs with... QuickGraph: A 100% C# graph library with Graphviz Support. A generic directed graph library with a... A 2D Graph Component With Zoom Capability A 2D graph component with zoom capability. WPF: A graph control A WPF graph control with autoscaling and... Announcements Build Azure App - Win a Laptop WP7 Comp - Post an Article, Share an App The Daily Insider 30 free programming books Daily News: Signup now.