Console Application
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Console Application
Is it possible to create a graph as an image file in a console application?
Re: Console Application
Hello MikeTheLad,
Yes is possible. You only have added TeeChart.dll and System.Windows.Forms references and then you can do something as next:
Please, can you confirm us if previous code works as you expected?
I hope will helps.
Thanks,
Yes is possible. You only have added TeeChart.dll and System.Windows.Forms references and then you can do something as next:
Code: Select all
class Program
{
static void Main(string[] args)
{
Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart();
Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line.FillSampleValues();
tChart1.Export.Image.JPEG.Save(@"C:\tmp\ConsoleImage.jpg");
}
}
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: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
I get the error below
Error 1 The type 'System.Windows.Forms.Control' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
I can't add System.Windows.Forms as not on my list
Error 1 The type 'System.Windows.Forms.Control' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
I can't add System.Windows.Forms as not on my list
Re: Console Application
Hello MikeTheLad,
Please follow next steps:
1.- Click with right button on folder of references
2.- Select Add Reference
3.- Select Tab .Net
4.- Find System.Windows.Froms in the list and add it in the project and run it.
Please can you confirm us if using previous steps you can find the reference?
I hope will helps.
Thanks,
Please follow next steps:
1.- Click with right button on folder of references
2.- Select Add Reference
3.- Select Tab .Net
4.- Find System.Windows.Froms in the list and add it in the project and run it.
Please can you confirm us if using previous steps you can find the reference?
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: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
Thanks, I was trying the COM reference, produce a sample graph file now. So I assume now I have all the functions off all graphs available.
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
How would I go about specifying the size of the graph?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Console Application
Hi MikeTheLad,
You can either set the chart control dimensions:
Or set the exported image dimensions:
You can either set the chart control dimensions:
Code: Select all
tChart1.Width = 800;
tChart1.Height = 600;
Code: Select all
tChart1.Export.Image.JPEG.Width = 800;
tChart1.Export.Image.JPEG.Height = 600;
tChart1.Export.Image.JPEG.Save(@"C:\tmp\ConsoleImage.jpg");
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 |
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
Have sorted the sizing
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
This is all working fine in Visual 2010, I am now trying in a Visual 2008 application to do the same, on the line
Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart();
This is falling over with "Object reference not set to an instance of an object.", all the dll are in place and registered as per the 2010 app
Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart();
This is falling over with "Object reference not set to an instance of an object.", all the dll are in place and registered as per the 2010 app
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Console Application
Hi MikeTheLad,
This error message indicates that your application doesn't have the design-time license properly compiled into it as I explained here.
This error message indicates that your application doesn't have the design-time license properly compiled into it as I explained here.
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 |
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
I did see this thread before and belive this is the problem however this is for V2, we have V1
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
Also, this solution does have a website and the graph works fine in this
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Console Application
Hi MikeTheLad,
If problems persist please attach a simple example project we can run "as-is" to reproduce the problem here.
Thanks in advance.
I think this also applies to later v1 releases.I did see this thread before and belive this is the problem however this is for V2, we have V1
The web application could be set up correctly but not the console application. Could you please check it has licenses.licx compiled as an embedded resource?Also, this solution does have a website and the graph works fine in this
If problems persist please attach a simple example project we can run "as-is" to reproduce the problem here.
Thanks in advance.
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 |
-
- Newbie
- Posts: 65
- Joined: Mon Jan 19, 2004 5:00 am
Re: Console Application
That was it, I added that file to the project and can now create graphs, however I only getting one bar per series, code is:-
Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart();
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
Steema.TeeChart.Styles.Bar bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
tChart1.Legend.Visible = true;
tChart1.Header.Text = "";
tChart1.Chart.Panel.Color = System.Drawing.Color.White;
tChart1.Chart.Panel.Visible = false;
tChart1.Chart.Walls.Visible = false;
tChart1.Chart.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Chart.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Aspect.View3D = false;
tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Title.Visible = true;
tChart1.Axes.Bottom.Title.Text = "Age";
tChart1.Axes.Left.Title.Visible = true;
tChart1.Axes.Left.Title.Text = "Frequency";
bar1.Add(300, "Jan");
bar1.Add(325, "Feb");
bar1.Add(287, "Mar");
bar1.Title = "Product10";
bar2.Add(175, "Jan");
bar2.Add(223, "Feb");
bar2.Add(241, "Mar");
bar2.Title = "Product12";
Steema.TeeChart.TChart tChart1 = new Steema.TeeChart.TChart();
Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
Steema.TeeChart.Styles.Bar bar2 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
tChart1.Legend.Visible = true;
tChart1.Header.Text = "";
tChart1.Chart.Panel.Color = System.Drawing.Color.White;
tChart1.Chart.Panel.Visible = false;
tChart1.Chart.Walls.Visible = false;
tChart1.Chart.Panel.Bevel.Outer = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Chart.Panel.Bevel.Inner = Steema.TeeChart.Drawing.BevelStyles.None;
tChart1.Aspect.View3D = false;
tChart1.Axes.Bottom.Automatic = false;
tChart1.Axes.Bottom.Title.Visible = true;
tChart1.Axes.Bottom.Title.Text = "Age";
tChart1.Axes.Left.Title.Visible = true;
tChart1.Axes.Left.Title.Text = "Frequency";
bar1.Add(300, "Jan");
bar1.Add(325, "Feb");
bar1.Add(287, "Mar");
bar1.Title = "Product10";
bar2.Add(175, "Jan");
bar2.Add(223, "Feb");
bar2.Add(241, "Mar");
bar2.Title = "Product12";
- Attachments
-
- RAL_488_AgeGraph.jpg (84.04 KiB) Viewed 17353 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Console Application
Hi MikeTheLad,
That's because you set bottom axis to be manual. You can either remove this line:
Or set its min. and max. values manually like this:
That's because you set bottom axis to be manual. You can either remove this line:
Code: Select all
tChart1.Axes.Bottom.Automatic = false;
Code: Select all
tChart1.Axes.Bottom.SetMinMax(0, 2);
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 |