|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
OWC11 (connect Spreadsheet + Chart)In my application I've got an AxSpreadsheet with data. I want to draw a chart from the data in the spreadsheet. I am having trouble "connecting" the spreadsheet to the chart. I found quite a few examples on the net on doing this but all of these examples says: ChartSpace1.DataSource = Spreadsheet1 This results in a "Option stric on disallows implicit conversion....." (I don't want to turn strict off) When I typecast to ChartSpace1.DataSource = CType(Spreadsheet1, msdatasrc.DataSource) and run the code, it results in "Specified cast is not valid" Any ideas? ( I am using VB.NET) Thanks in advance This isn't correct. The correct code and explanation, as taken from the
black book p.137, is listed below. Loading from a datasource Finally, the chart is capable of binding to a datasource directly. This datasource may not necessarily be a database but it can actually be a pivot listing or a spreadsheet component. In fact, the chart can bind to any container implementing the IDataSource interface. Binding a chart to a spreadsheet is a hidden gem because it provides the ability to chart data in real time. Let us examine one possibility. Code-listing 4.11 Sample code to bind to a spreadsheet C# snippet ChartSpace1.DataSource = Spreadsheet1.SetData(ChartDimensionsEnum.chDimCategories, (int) ChartSpecialDataSourcesEnum.chDataBound, "A1:A40"); SpreadSheet1.SetData(ChartDimensionsEnum.chDimValues, (int) ChartSpecialDataSourcesEnum.chDataBound, "B1:B40"); VB.NET snippet ChartSpace1.DataSource = Spreadsheet1.SetData(ChartDimensionsEnum.chDimCategories, CType (ChartSpecialDataSourcesEnum.chDataBound, "A1:A40", Integer)) SpreadSheet1.SetData(ChartDimensionsEnum.chDimValues, CType (ChartSpecialDataSourcesEnum.chDataBound, "B1:B40", Integer)) -- Show quoteHide quoteRegards, Alvin Bruney - ASP.NET MVP [Shameless Author Plug] The Microsoft Office Web Components Black Book with .NET Now available @ www.lulu.com/owc, Amazon.com etc "Pieter" <pauc***@webmail.co.za> wrote in message news:da0c29$2vo$1@ctb-nnrp2.saix.net... > Hi > > In my application I've got an AxSpreadsheet with data. > I want to draw a chart from the data in the spreadsheet. > > I am having trouble "connecting" the spreadsheet to the chart. > I found quite a few examples on the net on doing this but all of these > examples says: > ChartSpace1.DataSource = Spreadsheet1 > > This results in a "Option stric on disallows implicit conversion....." > (I don't want to turn strict off) > > When I typecast to > ChartSpace1.DataSource = CType(Spreadsheet1, msdatasrc.DataSource) > > and run the code, it results in "Specified cast is not valid" > > Any ideas? ( I am using VB.NET) > > Thanks in advance > >
How to update a Image control?
Infragistics Ultra Web Grid Updating Problem Listbox Webcontrol SelectedIndexChanged Event not working load event doesn't fire unless init event is present Complex CompareValidator Validations Finding the leftmost pixel in a piece of text when using GDI+ DataGrid and Paging. How to view properties of control inside table Client Side Calculation involving controls in datagrid template co Datagrid not displaying in apsx webpage |
|||||||||||||||||||||||