Over 10 Million Study Resources Now at Your Fingertips

Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Pages: 2

The page method checks whether the current requestfor the page postback

Chart State Management ❘689

private void GenerateRandomData(Series series)
const double MaxStep = 5.0;
var rand = new Random((int)DateTime.Now.Ticks);
var lastValue = 5.0;
for (int i = 0; i < 50; i++)
series.Points.AddXY(i + 1, lastValue);
lastValue += MaxStep * rand.NextDouble() - MaxStep/2; series.Points[i].YValues[0] = lastValue;

private void AddNewSeries(string name, double distance)
var baseSeries = Chart1.Series[“Default”];
var newSeries = new Series(name);
newSeries.ChartType = SeriesChartType.Spline;
newSeries.BorderWidth = baseSeries.BorderWidth;
foreach (var point in baseSeries.Points)
newSeries.Points.AddXY(point.XValue, point.YValues[0] + distance);

The key to the solution is the Form_Init method that turns on chart state management by setting the EnableViewState property to true . The Page_Load method checks whether the current request

for the page is a postback. If it is the fi rst call, the random series is generated. After the default series is either generated or loaded from the view state, the upper and lower splines are drawn according to the state of checkboxes.

Advanced Chart State Management

The BasicChartStateManagement.aspx page saves more state information than required, because it saves the state of the additional series that can be calculated (and it ’ s cheap) from the data generated for the base series. If there were a way you could tell the chart to save only the base series, you could save resources reserved by about a hundred data points. This is especially important when your chart contains more — let ’ s says a few hundred or thousand — data points.

How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Make payment
Document download
Download File
PageId: ELI528F89D
Uploaded by :
Page 1 Preview
the page method checks whether the current request
Sell Your Old Documents & Earn Wallet Balance