I'm using dotnet version 4.1.2010.9280 and am having a problem displaying charts in a web application where the chart includes a data table tool. Here is the situation.
I have a windows form application that allows users to create charts and which stores the .ten file in a database, I recently included functionality that allows a data tabel tool to be included on the charts if required.
I also have a web application that used tchart web component to display the .ten files previously saved in the database. Up until I added functionality to allow data tables on that charts this has all worked fine, however, now I'm having problems. See the following code, to get this to work I have to remove the data table tool with the marked code otherwise the foillowing line throws this error.
The Refresh_Source function takes two parameters the first being of type STEEMA.TCHART.CHART. It is this that it is complaining about and ONLY complains if there is a data table present on the chart."Unable to cast object of type 'Steema.TeeChart.Web.WebChart' to type 'Steema.TeeChart.TChart'
Code: Select all
Dim memstream As New System.IO.MemoryStream(m_chart.m_bTeeData)
memstream.Position = 0
WebChart.Clear()
WebChart.Chart.Import.Template.Load(memstream)
>>>>>
if this bit is removed the following line fails.
For i As Integer = WebChart.Chart.Tools.Count - 1 To 0 Step -1
WebChart.Chart.Tools.RemoveAt(i)
Next
>>>>>
m_chart.Refresh_Source(WebChart.Chart, m_sByValue)