Line next to Y Axis
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Line next to Y Axis
Have a line graph with a scale of -100 to 100, but require a line at 0, I have added a line but using value of 0, but this needs to be right next to the 0 on the Y-Axis with no gap, but still maintain the gap on the other lines.
- Attachments
-
- graph.JPG (84.53 KiB) Viewed 15179 times
Re: Line next to Y Axis
Hello mikethelad,
Ok. I have made a simple project where the first line is drawn gap to left axis and second line is drawn on the left axis. To achieve it I have used a extra horizontal axis I have assigned to second line. Please, see next code:
Could you tell us if previous code works in your end? If you have any problems please let me know.
I hope will helps.
Thanks,
Ok. I have made a simple project where the first line is drawn gap to left axis and second line is drawn on the left axis. To achieve it I have used a extra horizontal axis I have assigned to second line. Please, see next code:
Code: Select all
Steema.TeeChart.Styles.Line line1, line2;
Steema.TeeChart.Axis axis1;
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
line1 = new Line(tChart1.Chart);
line2 = new Line(tChart1.Chart);
//Custom Horizontal Axis
axis1 = new Axis(tChart1.Chart);
axis1.Horizontal = true;
tChart1.Axes.Custom.Add(axis1);
//Populate
Random rnd = new Random();
for (int i = 0; i < 10; i )
{
line1.Add(((i 100)*2), rnd.Next(100));
line2.Add(((i 100)* 2),0);
}
//Assign line axis
line1.HorizAxis = HorizontalAxis.Bottom;
line2.CustomHorizAxis = axis1;
// Customize axis.
tChart1.Axes.Left.SetMinMax(-100, 100);
tChart1.Axes.Bottom.StartPosition = 1;
tChart1.Axes.Left.AxisPen.Visible = false;
tChart1.Axes.Bottom.AxisPen.Visible = false;
axis1.SetMinMax(line2.XValues.Minimum, line2.XValues.Maximum);
axis1.Labels.Visible = false;
axis1.AxisPen.Visible = false;
}
I hope will helps.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Re: Line next to Y Axis
Thanks, does not like the following line
tChart1.Axes.Custom.Add(axis1);
tChart1.Axes.Custom.Add(axis1);
Re: Line next to Y Axis
Hello mikethelad,
Sorry, but I don't understand what is the problem because the code works in correct way for me. Would be very grateful if you can tell us the exactly problem you have with line of code tChart1.Axes.Custom.Add(axis1);
Thanks,
Sorry, but I don't understand what is the problem because the code works in correct way for me. Would be very grateful if you can tell us the exactly problem you have with line of code tChart1.Axes.Custom.Add(axis1);
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Re: Line next to Y Axis
See attached screen shot
- Attachments
-
- error.JPG (54.83 KiB) Viewed 15083 times
Re: Line next to Y Axis
Hello mikethelad,
Ok. I have attached my test project that works fine in my machine. Please, check if the code works in your end.
Thanks,
Ok. I have attached my test project that works fine in my machine. Please, check if the code works in your end.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Re: Line next to Y Axis
I am using Visual Studio 2008, could that be why?
Re: Line next to Y Axis
Hello mikethelad,
Ok. I have attached a project made in VS2008. Please, check if it works in your end.
Thanks,
Ok. I have attached a project made in VS2008. Please, check if it works in your end.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Re: Line next to Y Axis
Ok that work fine, will have to try work out the issue with my app, as mine is a web app
Can the -100, 0 , 100 on the Y Axis scale be made bold?
Can the X Axis be inline with -100 and not below, I have the following code for the scale
WebChart1.Chart.Axes.Left.SetMinMax(-100, 100);
Can the -100, 0 , 100 on the Y Axis scale be made bold?
Can the X Axis be inline with -100 and not below, I have the following code for the scale
WebChart1.Chart.Axes.Left.SetMinMax(-100, 100);
Re: Line next to Y Axis
Hello mikethelad,
Thanks for information. Now I see the problem in your code. I have modify my code for you because it works with WebChart, please check if code works in your end:
I hope will be help.
Thanks,
Thanks for information. Now I see the problem in your code. I have modify my code for you because it works with WebChart, please check if code works in your end:
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
InitializeChart();
}
Steema.TeeChart.Styles.Line line1, line2;
Steema.TeeChart.Axis axis1;
private void InitializeChart()
{
WebChart1.Chart.Aspect.View3D = false;
line1 = new Line(WebChart1.Chart);
line2 = new Line(WebChart1.Chart);
axis1 = new Axis(WebChart1.Chart);
WebChart1.Chart.Axes.Custom.Add(axis1);
axis1.Horizontal = true;
Random rnd = new Random();
for (int i = 0; i < 10; i )
{
line1.Add(((i 100) * 2), rnd.Next(100));
line2.Add(((i 100) * 2), 0);
}
line1.VertAxis = VerticalAxis.Left;
line1.HorizAxis = HorizontalAxis.Bottom;
line2.VertAxis = VerticalAxis.Left;
line2.CustomHorizAxis = axis1;
axis1.SetMinMax(line2.XValues.Minimum, line2.XValues.Maximum);
axis1.Labels.Visible = false;
WebChart1.Chart.Axes.Left.SetMinMax(-100, 100);
WebChart1.Chart.Axes.Bottom.StartPosition = 1;
WebChart1.Chart.Axes.Left.AxisPen.Visible = false;
WebChart1.Chart.Axes.Bottom.AxisPen.Visible = false;
axis1.AxisPen.Visible = false;
}
I hope will be help.
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Re: Line next to Y Axis
Great, works see new sample,
Can the X Axis be inline with -100 and not below?
Can the X Axis be inline with -100 and not below?
- Attachments
-
- graph1.JPG (81.17 KiB) Viewed 15065 times
Re: Line next to Y Axis
Hello mikethelad,
I am afraid I can not reproduce your problem using last version of TeeChartFor.Net, could you tell us which version are you using? On the other hand, a solution for you is change the minimum offset of Left Axis, as do in next line of code:
I hope will helps.
Thanks,
I am afraid I can not reproduce your problem using last version of TeeChartFor.Net, could you tell us which version are you using? On the other hand, a solution for you is change the minimum offset of Left Axis, as do in next line of code:
Code: Select all
WebChart1.Chart.Axes.Left.MinimumOffset = -1;
Thanks,
Best Regards,
Sandra Pazos / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 58
- Joined: Thu Jul 05, 2012 12:00 am
Re: Line next to Y Axis
Thanks, had this set for some reason
WebChart1.Chart.Axes.Left.MinimumOffset = 15;
Assume Bold of the 0 ,100 and - 100 on the scale is not possible
WebChart1.Chart.Axes.Left.MinimumOffset = 15;
Assume Bold of the 0 ,100 and - 100 on the scale is not possible
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Line next to Y Axis
Hi mikethelad,
Is not possible to customize the font style for specific labels. For that you should use custom axis labels as demoed in the All Features\Welcome\Axes\Custom labels example at the features demo, available at TeeChart's program group.
Is not possible to customize the font style for specific labels. For that you should use custom axis labels as demoed in the All Features\Welcome\Axes\Custom labels example at the features demo, available at TeeChart's program group.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |