Can Infragistics be used in Console applications? I have a console application where I have to generate charts and put them on excel files. Please let me know if it possible and if so, how? A sample code is appreciated. Thanks!
Take a look at this thread:
http://forums.infragistics.com/forums/p/9352/36483.aspx#36483
It tells you how to save the chart as an image, and then you can just insert them into excel. Hope this helps -Paul
But how to generate the chart from a console application. That was my first question. Is it possible with Infragistics?
Here's the code to accomplish the task:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Infragistics.Win.UltraWinChart;
using Infragistics.Excel;
using System.IO;
{
class Program
UltraChart uc = new UltraChart();
uc.Data.DataBind();
Worksheet ws = wb.Worksheets.Add("worksheet1");
wsi.TopLeftCornerCell = ws.Rows[0].Cells[0];
wsi.BottomRightCornerCell = ws.Rows[2].Cells[5];
ws.Shapes.Add(wsi);
}
References that you need:
-Infragistics.Excel
-Infragistics.Shared
-Infragistics.Win.UltraWinChart
-Infragistics.Win
-System.Drawing
-System.Windows.Forms
Note: Minimum requirement of NetAdvantage 2007 Volume 2.
Hi,
I am getting a chart on the excel sheet, but how to give the x-axis label, y-axis label and the values of the x-axis and y-axis.
How to give the Title to the chart that is getting saved on excel sheet.
Please reply as soon as possible so that i can proceed further.
Thanks & Regards,
Shilpa Gopalan
The labels will depend on the Columns of your table along with the values in certain string columns.
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Chart_Labels.html
There is also a TitleTop property you can use to set the title:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinChart.v8.2~Infragistics.Win.UltraWinChart.UltraChart~TitleTop.html
Sample attached that uses 2008 Volume 2 CLR 2.0. To run sample for other versions of NetAdvantage please change the references to the appropriate version.
I am using NedAdvantage 2008 3.5 version, is the SaveTo() function of rendering the Infragistics chart present in this version.
If yes, give me the sample.
Regards,
What version of our controls are you using? The needed references are listed at the bottom of the code sample along with the requirement to use NetAdvantage 2007 Volume 2 and up.
The SaveTo function has 4 different signatures, one of which takes a Infragistics.UltraChart.Shared.Styles.RenderingType enumeration in the 2nd parameter.
2007.2 SaveTo function:
http://help.infragistics.com/Help/NetAdvantage/NET/2007.2/CLR2.0/html/Infragistics2.Win.UltraWinChart.v7.2~Infragistics.Win.UltraWinChart.UltraChart~SaveTo.html
2008.2 SaveTo function:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinChart.v8.2~Infragistics.Win.UltraWinChart.UltraChart~SaveTo.html
As for the sizing of the image. If you do not want to use the cells to position the image you will have to set your size in twips which is about 1/20th of a point. For further information on sizing using twips, please see the following post:
http://forums.infragistics.com/forums/p/5252/37655.aspx#37655
Infragistics.UltraChart.Shared.Styles.RenderingType.Image" to System.Drawing.Imaging.Image.
Have you removed this feature from the excel, if not tell me the dll file so that i can also use the same for my code.
2. Eventhough i use the code, wsi.PositioningMode = ShapePositioningMode.DontMoveOrSizeWithCells; the image is getting shrinked , Is there any solution to make the Image not to move for the particular location or shrink it.
MemoryStream ms = new MemoryStream();
uc.Data.DataSource = Infragistics.UltraChart.Data.DemoTable.Table(0);
Workbook wb = new Workbook();
Such functionality is not possible. Feel free to submit a feature request here:http://devcenter.infragistics.com/Protected/RequestFeature.aspx