Refreshing a SubChart
Posted: Thu Jul 23, 2009 10:04 pm
Using TeeChart .NET 4.0.2009.21355
Using VB Express 2008
I am trying to refresh a SubChart using the following method, which worked in TeeChart 3.5:
Dim objects at class level:
In the load event handler for the window, after the main chart (TChart1) is set up, I create the SubChart:
In TChart1's AfterDraw event handler, I refresh the SubChart:
In SubChart's AfterDraw event handler, I do:
The SubChart never refreshes; neither the AfterDraw or Invalidated events fire (I didn't test any other events).
Jay
Using VB Express 2008
I am trying to refresh a SubChart using the following method, which worked in TeeChart 3.5:
Dim objects at class level:
Code: Select all
Dim SubTool As Steema.TeeChart.Tools.SubChartTool
Dim WithEvents SubChart As Steema.TeeChart.TChart
Code: Select all
If SubTool Is Nothing Then
SubTool = New Steema.TeeChart.Tools.SubChartTool(TChart1.Chart)
SubChart = SubTool.Charts.AddChart("ZoomChart")
SubChart.Left = 0
SubChart.Top = 0
SubChart.Width = TChart1.Width / 4
SubChart.Height = TChart1.Height / 4
SubChart.Header.Visible = False
SubChart.Aspect.View3D = False
SubChart.Panel.MarginUnits = Steema.TeeChart.PanelMarginUnits.Pixels
SubChart.Panel.MarginLeft = 0
SubChart.Panel.MarginRight = 0
SubChart.Panel.MarginTop = 0
SubChart.Panel.MarginBottom = 0
SubChart.Axes.Bottom.Labels.Visible = False
SubChart.Axes.Left.Labels.Visible = False
Line1 = New Steema.TeeChart.Styles.Line(SubChart.Chart)
Line1.DataSource = FlowTable 'set data source for this series
Line1.Title = FlowTable.Columns(1).ColumnName 'set series title
Line1.YValues.DataMember = FlowTable.Columns(1).ColumnName 'which column of table has the Y values
Line1.XValues.DataMember = FlowTable.Columns(0).ColumnName 'which column of table has the X values
Line1.XValues.DateTime = True 'x values are date and time values
Line1.Brush.Transparency = 0 'not transparent
Line1.Color = Color.Green
Line1 = New Steema.TeeChart.Styles.Line(SubChart.Chart)
Line1.DataSource = FlowTable 'set data source for this series
Line1.Title = FlowTable.Columns(2).ColumnName 'set series title
Line1.YValues.DataMember = FlowTable.Columns(2).ColumnName 'which column of table has the Y values
Line1.XValues.DataMember = FlowTable.Columns(0).ColumnName 'which column of table has the X values
Line1.XValues.DateTime = True 'x values are date and time values
Line1.Brush.Transparency = 0 'not transparent
Line1.Color = Color.Red
End If
Code: Select all
SubChart.Refresh()
Code: Select all
SubChart.Axes.Bottom.Automatic = False
SubChart.Axes.Bottom.Minimum = Math.Floor(NPTool.Series.XValues(NPTool.Point))
SubChart.Axes.Bottom.Maximum = Math.Floor(NPTool.Series.XValues(NPTool.Point)) + 1
Jay