Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

ASP.net VB.net reloading a chart

Posted on 2014-02-08
3
Medium Priority
?
514 Views
Last Modified: 2014-02-12
Hi
I am using the following code to generate a chart
I want the chart to reload every 10 seconds without the screen jumping
How do I achieve this?
Thanks


    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
             oChart
            'oLoad_Web_Layout_Data()
            ' Call Test()
        End If
    End Sub
    Sub oChart()
        ' Initialize the Chart object    
        Dim chart1 As New Chart()
        chart1.ID = "chart1"

        'Add to do code here
        If Not IsPostBack Then
            ' Initialize objects and elements
            Dim chartArea1 As New ChartArea()
            Dim legend1 As New Legend()
            Dim series1 As New Series()
            Dim series2 As New Series()
            Dim series3 As New Series()

            ' Set the Chart Properties
            chart1.Width = 340
            chart1.Height = 340

            chart1.Palette = ChartColorPalette.EarthTones
            chart1.Palette = ChartColorPalette.Fire
            chart1.BackColor = System.Drawing.Color.Gray
            chart1.BorderSkin.SkinStyle = BorderSkinStyle.Emboss

            chart1.BorderLineColor = System.Drawing.Color.Gray
            chart1.BorderlineDashStyle = ChartDashStyle.Solid
            chart1.BorderLineWidth = 4

            ' Set the ChartArea properties
            chartArea1.Name = "Default"
            chartArea1.BackColor = System.Drawing.Color.Gray

            'Enable AJAX features such as zooming and scrolling for the ChartArea
            'chartArea1.CursorX.UserEnabled = True
            'chartArea1.CursorY.UserEnabled = True
          
            ' Add the ChartArea to the Chart
            chart1.ChartAreas.Add(chartArea1)

            ' Set the Legend properties
            legend1.Name = "Default"
            legend1.Docking = Docking.Bottom
            legend1.LegendStyle = LegendStyle.Row
            legend1.Alignment = System.Drawing.StringAlignment.Center

            legend1.BackColor = System.Drawing.Color.Transparent
            legend1.BorderColor = System.Drawing.Color.Black
            legend1.BorderWidth = 1

            ' Add the Legend to the Chart
            chart1.Legends.Add(legend1)

            ' Set the Series properties
            series1.BorderColor = System.Drawing.Color.DarkSlateGray
            series1.Name = "Series1"
            series1.ChartType = SeriesChartType.SplineArea

            series2.BorderColor = System.Drawing.Color.DarkSlateGray
            series2.Name = "Series2"
            series2.ChartType = SeriesChartType.Column

            series3.Name = "Series3"
            series3.BorderWidth = 3
            series3.ChartType = SeriesChartType.Spline

            ' Add the Series to the Chart
            chart1.Series.Add(series1)
            chart1.Series.Add(series2)
            chart1.Series.Add(series3)

            ' Add points to each series.
            Dim rnd As New Random()

            For Each ser As Series In chart1.Series
                For i As Integer = 0 To 12
                    ser.Points.AddY(rnd.[Next](5, 40))
                Next
            Next

            'Preserve the chart's state during callbacks
            'chart1.CallbackStateContent = CallbackStateContent.All
        End If

        ' You MUST add the Chart to a form. By default, form1 is created on aspx pages.
        Me.form1.Controls.Add(chart1)
    End Sub

Open in new window

0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 39853795
You would need to use update panels to reload chart without refreshing page and javascript to refresh chart on an interval.
0
 

Author Closing Comment

by:Murray Brown
ID: 39853801
thanks very much
0
 

Author Comment

by:Murray Brown
ID: 39853824
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

647 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question