Zooming in Asp.Net

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Will
Newbie
Newbie
Posts: 6
Joined: Mon Jul 07, 2014 12:00 am

Zooming in Asp.Net

Post by Will » Fri Apr 24, 2015 5:12 am

When using the ZoomTool in an Asp.Net project, the area zoomed on is sometimes not calculated correctly.
It seems to go along with the size of the window.

When the window is maximized everything works as expected. If it's not, the area zoomed on is too far
in the future. Changing the width of the window makes zooming work again sometimes, sometimes it
doesn't.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Zooming in Asp.Net

Post by Sandra » Fri Apr 24, 2015 11:23 am

Hello Will

Unfortunately, after doing many tests, we can’t reproduce the problem here with a simple project. TeeChart's javscript code, that generates the location information should take into account frame offsets or scroll position of the page. Perhaps there is a problem with that code for the application you are running.

Does the problem occur in the same way on different browsers? If yes, could you tell us what browsers? Is it possible to send us a small sample application to help us reproduce the issue?

Thanks in advance,
regards.
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Will
Newbie
Newbie
Posts: 6
Joined: Mon Jul 07, 2014 12:00 am

Re: Zooming in Asp.Net

Post by Will » Fri Apr 24, 2015 11:39 am

I could recreate it on a smaller scale project.

aspx

Code: Select all

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TeeChartTest.WebForm1" %>

<%@ Register Assembly="TeeChart" Namespace="Steema.TeeChart.Web" TagPrefix="tchart" %>
<%@ Register Namespace="TeeChartTest" Assembly="TeeChartTest" TagPrefix="uc" %>

<!DOCTYPE html>

<style>
    body {
        height: 100%;
        width: 100%;
        margin: 0;
    }

    html {
        width: 1024px;
        margin: auto;
        height: 100%;
        min-height: 768px;
    }
</style>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        </div>

        <tchart:WebChart ID="WebChart" runat="server" Height="228px" Width="542px" GetChartFile="GetChart.aspx" TempChart="Session" />

        <p>
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Add random point" />
            <asp:Button ID="Button3" runat="server" OnClick="Button3_Click" Text="reset zoom" />
        </p>
    </form>
</body>
</html>

codebehind:

Code: Select all

using Steema.TeeChart.Styles;
using Steema.TeeChart.Tools;
using System;
using System.Collections;

namespace TeeChartTest
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        private string SSN_KEY_CHART_DATA = "chartData";

        protected void Page_Load(object sender, EventArgs e)
        {
            InitializeChart();
            CheckZoom();
        }

        private void InitializeChart()
        {
            if (WebChart.Chart.Tools.Count == 0)
            {
                WebChart.Chart.Tools.Add(new ZoomTool());
            }

            RestoreState();

            if (WebChart.Chart.Series.Count == 0)
            {
                Line series1;
                WebChart.Chart.Aspect.View3D = false;
                WebChart.Chart.Legend.Visible = false;
                series1 = new Line(WebChart.Chart);

                series1.FillSampleValues();
                SaveState();
            }
        }

        private System.IO.MemoryStream ChartData
        {
            get
            {
                if (Page.Session[SSN_KEY_CHART_DATA] == null)
                {
                    Page.Session[SSN_KEY_CHART_DATA] = new System.IO.MemoryStream();
                }

                System.IO.MemoryStream tmp = Page.Session[SSN_KEY_CHART_DATA] as System.IO.MemoryStream;
                tmp.Seek(0, System.IO.SeekOrigin.Begin);

                return tmp;
            }
            set
            {
                Page.Session[SSN_KEY_CHART_DATA] = value;
            }
        }

        public void SaveState()
        {
            ChartData = new System.IO.MemoryStream();
            WebChart.Chart.Export.Template.Save(ChartData);
        }

        private void RestoreState()
        {
            if (ChartData.Length != 0)
            {
                WebChart.Chart.Import.Template.Load(ChartData);
            }
        }

        private void CheckZoom()
        {
            CheckZoom((ArrayList)Session[UniqueID + "Zoomed"]);
        }

        private void CheckZoom(ArrayList zoomedState)
        {
            ZoomTool zoomTool = (ZoomTool)WebChart.Chart.Tools[0];

            zoomedState = zoomTool.SetCurrentZoom(Page.Request, zoomedState);
            if (zoomedState == null)
            {
                Session.Remove(UniqueID + "Zoomed");
            }
            else
            {
                Page.Session.Add(UniqueID + "Zoomed", zoomedState);
            }
        }

        protected void Button3_Click(object sender, EventArgs e)
        {
            CheckZoom(null);
            Page_Load(sender, e);
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //WebChart.Chart.Series[0].Add()
        }
    }
}
The problem is browser-independent. Tested it with IE 10 and chrome. It is important that it works in IE10.

It seems to have something to do with the style.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Zooming in Asp.Net

Post by Sandra » Fri Apr 24, 2015 3:11 pm

Hello Will,

Thank you for the code. We are working to reproduce a stable situation where the problem occurs. We try to give you an answer as soon as possible.

Thanks in advance,
regards.
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Zooming in Asp.Net

Post by Sandra » Mon Apr 27, 2015 10:40 am

Hello Will,

Finally, we have reproduced the problem you are experiencing, using Chrome and Firefox, but not using IE11. We have already added the problem in .Net Bugzilla tracker. Here's the link http://bugs.teechart.net/show_bug.cgi?id=1201.
Feel Free to add your email account to the ticket so you can be automatically notified when and update arrives.

Thanks in advance,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Will
Newbie
Newbie
Posts: 6
Joined: Mon Jul 07, 2014 12:00 am

Re: Zooming in Asp.Net

Post by Will » Tue May 05, 2015 11:12 am

Hello Sandra,

The status of the Bug is: RESOLVED FIXED

What does this mean for me? Is the fix available in the next release, or is there a hotfix i can use?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: Zooming in Asp.Net

Post by Narcís » Thu May 07, 2015 2:03 pm

Hello Will,

The fix will be included in the next maintenance release. There's no patch we can provide unless you are a source code customer. That being the case we would provide the necessary source code modifications.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Zooming in Asp.Net

Post by Marc » Thu May 07, 2015 6:28 pm

Hello Will,

We've just reviewed this and can confirm that we'll be able to make a pre-release version available to you for tests. We'll contact you with the access details.

Regards,
Marc Meumann
Steema Support

Post Reply