The best place for that sort of thing would be to download the office web
component tool pack. The different chart types are in there. The code to
create charts are the same. the only thing you need to change is the chart
type. This is true for all chart types with the exception of the 4 or 5
surface. These charts typically do not have defined category/value axes. A
few examples would be bubble, pie and doughnut charts. These charts require
Got tidbits? Get it here...
"Edward" <zishi@citiz.net> wrote in message
news:uI29Hx6ZEHA.996@TK2MSFTNGP12.phx.gbl...
> Alvin, Thank you for your kind answer. It's the second time you helped
> me.
>
> Do you have any other documents about different chart types, I cannot
> find
> enough materials to guide my step of creating different charts.
>
> Edward
>
>> your dataset variable is a bit misleading. the chart cannot bind to
> datasets
>> because the chart does not implement Ilistsource. your dataset example
>> should actually contain a series portion so as not to confuse users.
>>
>> Also you can use the object browser to find the methods, or follow this
> link
>> for a complete interface spec
>>
http://www.webtropy.com/articles/art14-2.asp?Interop=OWC >>
>> --
>> Regards,
>> Alvin Bruney
>> [ASP.NET MVP
http://mvp.support.microsoft.com/default.aspx]
>> Got tidbits? Get it here...
http://tinyurl.com/27cok >> "Jo Inferis" <inferis@NOSPAM.gotadsl.co.uk> wrote in message
>> news:ODYi7D3ZEHA.2544@TK2MSFTNGP10.phx.gbl...
>> > Edward wrote:
>> >> Can anybody drop some clue for me? Thanks.
>> > I'll give it a try (I'm thinking of writing something about my
> experience
>> > with OWC, little as it is, it still seems to be more than is available
> on
>> > the web in C#)
>> >
>> > What follows is a simple (working) chart example, in C#, which uses
>> > OWC.
>> > It's fairly trivial to extend this to use a database or other
>> > datasource
>> > for
>> > the categories and values (I know, I've done it :)
>> >
>> > <code language="C#">
>> > using System;
>> > using System.Web.UI;
>> >
>> > //the format of this line is important
>> > using OWC = Microsoft.Office.Interop.OWC;
>> >
>> > public class Chart : System.Web.UI.Page
>> > {
>> > private void Page_Load(Object sender, EventArgs e)
>> > {
>> > Response.Buffer = true;
>> > Response.ContentType = "image/gif";
>> >
>> > string Categories =
>> >
> "Jan,Feb,March,April,May,June,July,August,September,October,November,Decembe
>> > r";
>> > string Values = "1,2,3,4,5,6,7,8,9,10,11,12";
>> > int ChartHeight = 400;
>> > int ChartWidth = 400;
>> >
>> > OWC.ChSeries DataSet;
>> > OWC.ChChart TheChart;
>> >
>> > //create a new chartspace:
>> > OWC.ChartSpace myChartSpace = new OWC.ChartSpace();
>> >
>> > //add a chart to it
>> > TheChart = myChartSpace.Charts.Add(0);
>> >
>> > //add a dataset to the chart
>> > DataSet = TheChart.SeriesCollection.Add(0);
>> >
>> > //name it
>> > DataSet.SetData(OWC.ChartDimensionsEnum.chDimSeriesNames, (int)
>> > OWC.ChartSpecialDataSourcesEnum.chDataLiteral, "OWC DataSet");
>> >
>> > //set the dataset plot type
>> > DataSet.Type = OWC.ChartChartTypeEnum.chChartTypeColumnStacked;
>> >
>> > //populate it
>> > DataSet.SetData(OWC.ChartDimensionsEnum.chDimCategories, (int)
>> > OWC.ChartSpecialDataSourcesEnum.chDataLiteral, Categories);
>> > DataSet.SetData(OWC.ChartDimensionsEnum.chDimValues, (int)
>> > OWC.ChartSpecialDataSourcesEnum.chDataLiteral, Values);
>> >
>> > //set the chart labels
>> > TheChart.HasTitle = true;
>> > TheChart.Title.Caption = "A Simple Chart";
>> > TheChart.Title.Font.Name = "Arial";
>> > TheChart.Title.Font.Size = 8;
>> > TheChart.Title.Font.Bold = true;
>> >
>> > TheChart.Axes[0].HasTitle = true;
>> > TheChart.Axes[0].Title.Caption = "Categories";
>> > TheChart.Axes[0].Title.Font.Name = "Verdana";
>> > TheChart.Axes[0].Title.Font.Size = 8;
>> >
>> > TheChart.Axes[1].HasTitle = true;
>> > TheChart.Axes[1].Title.Caption = "Values";
>> > TheChart.Axes[1].Title.Font.Name = "Verdana";
>> > TheChart.Axes[1].Title.Font.Size = 8;
>> >
>> > //Return the new chart in GIF format.
>> > Response.BinaryWrite((byte[]) myChartSpace.GetPicture("gif",
> ChartWidth,
>> > ChartHeight));
>> > Response.End();
>> > }
>> > }
>> > </code>
>> >
>> > This assumes you've installed the OWC into the GAC successfully (though
>> > you
>> > will need to reference the dll when you compile - this may be obvious,
> but
>> > I've been compiling *everything* by hand and find it's the best way for
> me
>> > to understand what's going on).
>> >
>> > To generate a chart from this, all you have to do is add the compiled
>> > library to the %application%/bin folder and then create an aspx file
> just
>> > containing "<%@ Page Inherits="Chart" %>" then point your browser at it
> :)
>> >
>> > It's worthwhile having a read of the OWC interop known issues (which
>> > explains the format of the using directive) :
>> >
>> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/htm
> l/odc_piaissues.asp
>> >
>> > and having access to something like VB so you can view the object model
>> > for
>> > the OWC (actually, if there's a tool out there which allows one to do
> this
>> > without having to run VB or Visual Studio, I'd love to know...)
>> >
>> > HTH!
>> > --
>> > jo inferis
>> >
>> >
>>
>>
>
>