Page 1 of 1

Webchart zoom

Posted: Thu Jul 13, 2006 8:57 pm
by 9790349
Hi,

Using WebChart in ASP.NET application we found that the Internet Explorer and Firefox cache the rendered image during zooming.

How to reproduce:

1. Show a Chart on the webpage
2. Zoom
3. Unzoom
4. Show an another chart
5. Zoom
6. Unzoom -> You will see the first Chart ( No event on the webserver, browser restore the image from the cache)

During the investigation of the problem we found the following:

The URL of the page when chart is unzoomed (step 3 and 6) was:

Chart.aspx?chart=WebChart1&zoom=0

The browser noticed no change in URL -> it restored the image from the cache!

We found a solution for this problem, but it is not too elegant:

1. Firefox:

- type about:config in the address field and click Go
- set browser.cache.check_doc_frequency to 1

(more information about about:config see http://kb.mozillazine.org/Firefox_:_FAQ ... ig_Entries)

2. Internet Explorer

- Tools / Internet Options...
- on General Page / Temporary Internet files section click Settings...
- select Every visit to the page option

I said that this is not an elegant solution, because you have to modify the browser configuration at all clients.

Have you another idea how to eliminate this problem?

(We suggest to add a random string parameter to the URL during zooming for example, GUID, like this:

Chart.aspx?chart=WebChart1&zoom=0&guid=a12345-b1234-...)

Best regards,

Gabor Varga

P.S. We found an another solution (http://www.dotnetbips.com/articles/disp ... spx?id=288) but we did not tested yet...

Posted: Fri Jul 14, 2006 10:19 am
by narcis
Hi madve,

I couldn't reproduce the issue here. I created a WebForm chart, I zoomed and unzomeed, I cleared the chart, added a new series and populated it, zoomed and unzommed new series and nothing was wrong. Are the steps I did the correct ones to reproduce the issue?

It would be very helpful if you could send us an example we can run "as-is" to reproduce the issue here. You can post your files at news://www.steema.net/steema.public.attachments newsgroup.

Thanks in advance.

Posted: Fri Jul 14, 2006 11:46 am
by 9790349
Hi NarcĂ­s,

One step missing from my reproduce procedure:

You have to go to another page between step 3 and 4.

We have more forms, on one of them (called ProfileForm.aspx) you can edit WebChart properties (Axes, Colors, Add new Series etc.) and there is a button which call the Chart.aspx to display the series.

Our test procedure:

- Load ProfileForm.aspx (which restores WebChart settings from database)
- click on button to call Chart.aspx
- Zoom
- Unzoom
- Return to ProfileForm.aspx
- Modify something (for example add a new Serie)
- click on button to call Chart.aspx
- (everything seems to be OK, the new Serie is on the Chart)
- Zoom
- Unzoom -> We get the first chart as image (without any event at all on the form!)
- Unzoom twice -> Event on form Page_Load and the image is now correct.

We using your code to display chart, from steema.public.attachment newsgroup, "D2006 Webforms example" (2006. 02. 15.), WebChart1.aspx called Chart.aspx in our project.

We navigating between this pages with the following code (Delphi .NET, javascript):

Code: Select all

procedure TWebForm2.ChangeURL( newURL : String );
var
  frameScript, S: String;
  str : StringBuilder;
begin

  str := StringBuilder.Create;

  with str do
  begin
    Append( '<script language="JavaScript">' );
    Append( 'top.work_frame.location.href = ''' );
    Append( newurl );
    S := str.ToString;

    if S.IndexOf( '?' ) > 0 then
      Append( '&GUID=' )
    else
      Append( '?GUID=' );

    Append( System.Guid.NewGuid.ToString );
    Append( '''</script>' );
  end;
  frameScript := str.ToString;
  Page.RegisterClientScriptBlock('FRAMESCRIPT', framescript);
end;
Best regards,

Gabor Varga

P.S.

We currently testing to add Chart.aspx Page_Load event the following line:

Response.Cache.SetCacheability(HttpCacheability.NoCache);

If this solves this problem, I will inform you.

Posted: Fri Jul 14, 2006 2:59 pm
by narcis
Hi Gabor,

Thanks for the information, I could reproduce the issue here. The problem is that the temporary chart stored in a session variable hasn't been updated since the new chart was created. What I did is:
  • -Load "home" WebForm
    -Loads "chart" WebForm
    -Zoom and UnZoom the chart
    -Go back to "home" WebForm
    -Load "chart" WebForm again
    -Click a button that removes existing series and adds new series to the chart.
    -Zoom the chart.
When zooming it still loaded the original chart because the Session variable containing the temporary chart hadn't changed. I could solve that by updating this variable with the new chart template after changing its settings:

Code: Select all

  protected void Button1_Click(object sender, EventArgs e)
  {
    Steema.TeeChart.Chart ch1 = WebChart1.Chart;
    ch1.Series.RemoveAllSeries();

    WebChart1.Chart.Series.Add(new Steema.TeeChart.Styles.Bar());
    ch1.Series[0].FillSampleValues(36);

    MemoryStream tmpChart = new MemoryStream();

    Session.Remove("ch1");
    ch1.Export.Template.Save(tmpChart);
    //save template to a Session variable
    Session.Add("ch1", tmpChart);   
  }