Teechart .NET v2 Zooming Focus Problem?
Posted: Fri Aug 14, 2009 4:07 pm
Hello,
I have a website that displays weather data using Teechart .NET v2 and Visual Basic. If I zoom into one webchart and then switch to a second webchart, the second webchart uses the same zoom level as the first webchart did. Is there a way to force a webchart to default to it's maximum zoom as defined by the WebChart1.Chart.Axes.Left.Maximum and WebChart1.Chart.Axes.Left.Minimum statements? Below is the code behind for one of my pages.
And here is the URL for the page...
http://mprlsrvr1.bio.nau.edu/wisard/dat ... ffect.aspx
cheers, Paul
I have a website that displays weather data using Teechart .NET v2 and Visual Basic. If I zoom into one webchart and then switch to a second webchart, the second webchart uses the same zoom level as the first webchart did. Is there a way to force a webchart to default to it's maximum zoom as defined by the WebChart1.Chart.Axes.Left.Maximum and WebChart1.Chart.Axes.Left.Minimum statements? Below is the code behind for one of my pages.
Code: Select all
Imports mysql.data.mysqlclient
Imports System.IO
Imports System.Data
Imports System.Windows
Imports Steema.TeeChart.TChart
Imports System.Data.SqlClient
Partial Class Data_display_rock_effect
Inherits System.Web.UI.Page
Protected Sub startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
'Create the DataTable
Dim dt As New DataTable()
Dim dt2 As New DataTable()
'Dim myConnection As New MySqlConnection("server=egr3.egr.nau.edu;uid=wis_str_datt_usr;pwd=gtdnj;database=wisard_streamed_data_test;")
Dim myConnection As New MySqlConnection("server=wisard-serv1.egr.nau.edu;uid=arb_webpage;pwd=m0(!3lasKc;database=Arb_At_Flagstaff;")
'Dim myConnection As New MySqlConnection("server=wisard-serv1.egr.nau.edu;uid=ph_web_app;pwd=Jns5@iHD$;database=Arb_At_Flagstaff;")
'Dim myConnection As New MySqlConnection("server=egr249a-02.egr.nau.edu;uid=wis_str_datt_usr;pwd=gtdnj;database=wisard_streamed_data_test;")
'Dim myConnection As New SqlConnection("server=mprlsrvr1.bio.nau.edu;uid=wiz_reader;pwd=$x15g53p;database=wiz_test;")
Dim strSQL, strSQL2 As String
'get the data into a datatable
strSQL = "SELECT * FROM processed_data WHERE ProbeID = 7 AND SensorID = 251"
Dim myAdapter As New MySqlDataAdapter()
myAdapter.SelectCommand = New MySqlCommand(strSQL, myConnection)
myAdapter.Fill(dt)
'test binding to a gridview (requires empty gridview on aspx page with identifer dgdata
'dgdata.DataSource = dt
'dgdata.DataBind()
'fill sql server version of data adapter
'strSQL = "SELECT * FROM data WHERE ProbeID = 7 AND SensorID = 251"
'Dim myAdapter As New SqlDataAdapter()
'myAdapter.SelectCommand = New SqlCommand(strSQL, myConnection)
'myAdapter.Fill(dt)
'create a second table
strSQL2 = "SELECT * FROM processed_data WHERE ProbeID = 10 AND SensorID = 251"
Dim myAdapter2 As New MySqlDataAdapter()
myAdapter2.SelectCommand = New MySqlCommand(strSQL2, myConnection)
myAdapter2.Fill(dt2)
'create a second table sql server version
'strSQL2 = "SELECT * FROM data WHERE ProbeID = 10 AND SensorID = 251"
'Dim myAdapter2 As New SqlDataAdapter()
'myAdapter2.SelectCommand = New SqlCommand(strSQL2, myConnection)
'myAdapter2.Fill(dt2)
'lets make a teechart!
'create first series
Dim Temperature As New Steema.TeeChart.Styles.Points(WebChart1.Chart)
WebChart1.Chart.Axes.Bottom.Labels.DateTimeFormat = "mm/dd/yyyy"
WebChart1.Chart.Axes.Bottom.Labels.Angle = 90
WebChart1.Chart.Axes.Bottom.Labels.Color = Drawing.Color.Black
WebChart1.Chart.Axes.Left.Maximum = 50
WebChart1.Chart.Axes.Left.Minimum = -15
'add one series using datatable dt
Temperature.DataSource = dt
Temperature.YValues.DataMember = dt.Columns("measurement").ToString()
Temperature.XValues.DataMember = dt.Columns("TimeStamp").ToString()
Dim srt1 As String = dt.Columns("TimeStamp").ToString
Temperature.LabelMember = srt1
Temperature.Color = Drawing.Color.DarkBlue
Temperature.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Cross
Temperature.Title = "1cm from rock"
'Dim seriesHotSpot1 As Steema.TeeChart.Tools.SeriesHotspot = New Steema.TeeChart.Tools.SeriesHotspot(WebChart1.Chart)
'Steema.TeeChart.Styles.MapAction.Mark is the default value
'seriesHotSpot1.MapAction = Steema.TeeChart.Styles.MapAction.Mark
'add second series
Dim Battery_Voltage As New Steema.TeeChart.Styles.Points(WebChart1.Chart)
'add second series using datatable dt2
Battery_Voltage.DataSource = dt2
Battery_Voltage.YValues.DataMember = dt2.Columns("measurement").ToString()
Battery_Voltage.XValues.DataMember = dt2.Columns("TimeStamp").ToString()
Battery_Voltage.Color = Drawing.Color.DarkRed
Battery_Voltage.Pointer.Style = Steema.TeeChart.Styles.PointerStyles.Diamond
Battery_Voltage.Title = "60cm from rock"
' add third series (highlight line)
'Dim highlight As New Steema.TeeChart.Styles.Line(WebChart1.Chart)
'highlight.XValues.DateTime = True
'highlight.Add(0, "8/21/2007 11:14:00 AM")
'highlight.Add(70, DateTime.Parse("8/21/2007 11:14:00 AM")
'highlight.Title = "Restart of Data Collection"
'highlight.Color = Drawing.Color.Aqua
'Dim colorLine1 As New Steema.TeeChart.Tools.ColorLine(WebChart1.Chart)
'colorLine1.AllowDrag = False
'colorLine1.Axis = WebChart1.Chart.Axes.Bottom
'colorLine1.Pen.Color = Drawing.Color.Yellow
'colorLine1.Value = DateTime.Parse("8/21/2007 11:14:00 AM")
'colorLine1.Value = Now.ToOADate()
'add zoom functionality
Dim zoomTool1 As Steema.TeeChart.Tools.ZoomTool = New Steema.TeeChart.Tools.ZoomTool(WebChart1.Chart)
CheckZoom(WebChart1)
End Sub
Private Sub CheckZoom(ByVal wChart As Steema.TeeChart.Web.WebChart)
Dim zoomedState As ArrayList = CType(Session((wChart.ID + "Zoomed")), ArrayList)
zoomedState = CType(wChart.Chart.Tools(0), Steema.TeeChart.Tools.ZoomTool).SetCurrentZoom(Request, zoomedState)
If (zoomedState Is Nothing) Then
Session.Remove((wChart.ID + "Zoomed"))
Else
Session.Add((wChart.ID + "Zoomed"), zoomedState)
End If
End Sub
Protected Sub ImageButton3_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton3.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/data_display/rock_effect.aspx")
End Sub
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/data_display/cinder.aspx")
End Sub
Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/data_display/rock_wall.aspx")
End Sub
Protected Sub ImageButton4_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton4.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/data_display/shade_sun.aspx")
End Sub
Protected Sub ImageButton5_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton5.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/default.aspx")
End Sub
Protected Sub ImageButton6_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton6.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/data_display/rock_effect_moist.aspx")
End Sub
Protected Sub ImageButton7_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton7.Click
Response.Redirect("http://mprlsrvr1.bio.nau.edu/wisard/data_display/rock_effect.aspx")
End Sub
End Class
http://mprlsrvr1.bio.nau.edu/wisard/dat ... ffect.aspx
cheers, Paul