0

This is my Chart control Graph:

enter image description here

I want to remove axis black lines from the left side and add blue line as a frame for all the graph like at the button. I have search for all the properties and try to change color but the default color still remained

user3328870
  • 341
  • 2
  • 7
  • 23

2 Answers2

2

I know this old post but to answer the OP question.

Changes the line color and line style

Chart1.ChartAreas(0).AxisY.LineColor = Color.Blue
Chart1.ChartAreas(0).AxisY.LineDashStyle =ChartDashStyle.Dot

If want to remove the tick marks you use this code

Chart1.ChartAreas(0).AxisY.MajorTickMark.Enabled = False
Chart1.ChartAreas(0).AxisY.MinorTickMark.Enabled = False
asparatu
  • 53
  • 8
1

if you want to customize a chart you could draw your own dynamically:

Example in VB.net:

 Const GraphHeight As Integer = 100
    Const GraphWidth As Integer = 200
    Dim cIMG As New Bitmap(GraphWidth, GraphHeight)
    Dim G As Graphics = Graphics.FromImage(cIMG)
    Dim red As Integer = 0
    Dim pnts(4) As Point
    pnts(0) = New Point(0, GraphHeight - 0)
    pnts(1) = New Point(50, GraphHeight - 80)
    pnts(2) = New Point(100, GraphHeight - 50)
    pnts(3) = New Point(150, GraphHeight - 40)
    pnts(4) = New Point(200, GraphHeight - 20)
    G.DrawLines(Pens.Blue, pnts)
    PictureBox1.Image = cIMG

Example in C#:

const int GraphHeight = 100;
const int GraphWidth = 200;
Bitmap cIMG = new Bitmap(GraphWidth, GraphHeight);
Graphics G = Graphics.FromImage(cIMG);
int red = 0;
Point[] pnts = new Point[5];
pnts(0) = new Point(0, GraphHeight - 0);
pnts(1) = new Point(50, GraphHeight - 80);
pnts(2) = new Point(100, GraphHeight - 50);
pnts(3) = new Point(150, GraphHeight - 40);
pnts(4) = new Point(200, GraphHeight - 20);
G.DrawLines(Pens.Blue, pnts);
PictureBox1.Image = cIMG;

you could use a loop to draw the grid

Example

Frank_Vr
  • 661
  • 7
  • 23
  • How to add this to my chart ? – user3328870 Mar 16 '14 at 12:34
  • instead of using a chart control you insert a picture box, then create you own chart dynamically. its a bit more complex but it gives you the freedom to do what ever. i can make you a better example if you want – Frank_Vr Mar 16 '14 at 22:38
  • It would be great if you can show me am example, also with screenshot if you can – user3328870 Mar 17 '14 at 08:49
  • My graph received real time data (my network adapter traffic), this is a problem ? i put all the points inside my Chart control via timer – user3328870 Mar 17 '14 at 13:26
  • well the above code is to make your own graph using a picture box control. i'm don't think there is a way to remove the black axis lines in the chart control. – Frank_Vr Mar 17 '14 at 13:37
  • here is my example: www.MateHop.com?GAJQ – Frank_Vr Mar 17 '14 at 13:42