Click here to Skip to main content
Email Password   helpLost your password?
pic1.jpg
Pic2.jpg
Pic3.jpgPic4.JPG

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:

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:

// 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:

 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.

 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:

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 <color> colorList; 
//Dark colors only

These global variables are being initialized using the constructor:

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.

//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 graphs

In 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.

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 <values.Length; i++)
 {
 
//Draw the bar


 SolidBrush brush = new SolidBrush(Color.FromArgb(alpha,colorList[i]));
 objGraphicPanel.FillRectangle(brush, 10, 190 - x, 10, 10); 
 string drawString = valueLabels[i] + " = " + values[i].ToString();
 Font drawFont = new Font(fontFormat, 8);
 SolidBrush drawBrush = new SolidBrush(Color.Black); 
 objGraphicPanel.DrawString(drawString,drawFont, drawBrush, 20, 190 - x);
 
//x axis spacing by 20


 x += 20;
 }
 graphicGraph.DrawImage(xPanel,300, 25); return (graph);
 }

 
//Embed x Panel[Line graph style] 


Bitmap EmbedXLinePanel(Bitmap graph)
 {
 Bitmap xPanel = new Bitmap(100, 200);
 Graphics objGraphicPanel = Graphics.FromImage(xPanel);
 Graphics graphicGraph = Graphics.FromImage(graph);
 for (int i = 1, x = 10; i < values.Length; i++)
 {
  
//Draw the bar


 SolidBrush brush = new SolidBrush(Color.FromArgb(alpha,colorList[i]));
 Pen colorPen = new Pen(brush,2);
 objGraphicPanel.DrawLine(colorPen,10, 190 - x, 20, 190 - x);
 string drawString = valueLabels[i - 1].ToString() + " - " + valueLabels[i].ToString();
 Font drawFont = new Font(fontFormat, 8);
 SolidBrush drawBrush = new SolidBrush(Color.Black);
 objGraphicPanel.DrawString(drawString, drawFont, drawBrush, 20, 190 - x);
 
//x axis spacing by 20 


 x += 20;
 }
 graphicGraph.DrawImage(xPanel,300, 25);
 return (graph);
 }

Let's check out the method to create a Bar graph. Here this method follows a simple algorithm:

  1. First prepare a white canvas of dimensions 200 X 200.
  2. Calculate the highest value [ x-axis values ].
  3. For each value on the x-axis...
  4. Draw the axis and place the bar graph on an enlarged canvas using EmbedAxis().
  5. Draw the x-value mapping to the color using EmbedXPanel().
 //Generate Bar graph


 public Bitmap DrawBarGraph()
 {
 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);

 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<float>(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:

  1. Draw a shadow.
  2. Draw a white line at the bottom of the graph to hide the shadow.
 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<float>(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:

  1. First prepare a white canvas of dimensions 200 X 200.
  2. Calculate the sum of all x-values [ x-axis values ].
  3. Initialize the start angle of the pie to 0 degrees.
  4. For each value...
  5. Place the pie graph on an enlarged the canvas using EmbedAxis(), with showAxis flag set to false.
  6. Draw the x-value mapping to the color using EmbedXPanel().
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.

 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().

 //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<int>(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

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralFix 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!
QuestionOHLC - 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()

AnswerRe: OHLC - Adding an extra line
Alex Tostevin
6:38 18 Jun '08  
Sorry - this has appeared in the wrong forum... not sure why.
GeneralGDI+ 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.Confused

Could you please lend a hand?

Mindfull you must be young jedi.

GeneralGood Job
Shibuv
6:17 8 May '08  
Good Job Anoop. Nice Work
A suggestion - horizontal bar graph in next version.

Shibu
GeneralVery good
jomet
2:32 11 Apr '08  
Thanks for your very nice article.
can i export this graphs to excel.
Laugh
GeneralRe: 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
Smile
GeneralTought is was a graph library...
axelriet
18:26 10 Apr '08  
But it's a chart library, very different.
GeneralZedgraph
zitun
6:55 10 Apr '08  
Hi,

This is well done, and quite nice. Just a question why don't you use zedgraph ?

Regards,

Zitun
GeneralRe: Zedgraph [modified]
Anoop Unnikrishnan
8:11 10 Apr '08  
Hi
As in the article "This article addresses the construction of a simple graph library using C#" . This library is written in a simple fashion so that user's can customize it to their needs.

Sometimes too much of graphics can slow down the performance of the application.

Regards
Anoop

modified on Friday, April 11, 2008 6:48 AM


Last Updated 10 Apr 2008 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2010