Page 1 of 1

WebChart X, Y location issue

Posted: Mon Jul 31, 2006 11:55 pm
by 9525970
Hello all,

I need help with a few issues in the webchart component. The issues are

a) Is there any way i can associate the series click event which right now is triggered by mouse left click with mouse right button ?

b) How do i get the actual screen location of the Webchart ? i tried reading from chartbounds but i only get the height and width in pixels. I need the top left corner actual screen location, Is there anyway i can get this ?

c) Can Teechart translate on screen X,Y location to x,y within the teechart coordinate system ? I tried tChart1.Axes.Bottom.CalcPosPoint() but didnt work.

c) Can I change the association of zoom from mouse left button to right button in a webchart ?

Thanks in advance

Posted: Tue Aug 01, 2006 11:26 am
by Chris
Hello,
a) Is there any way i can associate the series click event which right now is triggered by mouse left click with mouse right button ?
No, I'm afraid there isn't. This is because the IPostBackDataHandler.LoadPostData method provides no information as to which mouse button was clicked, only the x and y relative positions. I think this is true for all ASP.NET server controls.
b) How do i get the actual screen location of the Webchart ? i tried reading from chartbounds but i only get the height and width in pixels. I need the top left corner actual screen location, Is there anyway i can get this ?
This is not strictly TeeChart specific either, as any technique to find the screen location of a webchart will be the same for any ASP.NET Control. I'm sure you'll be able to Google for some pertinant answers but if you don't have any luck please come back to me and I'll try and help you some more.
c) Can Teechart translate on screen X,Y location to x,y within the teechart coordinate system ? I tried tChart1.Axes.Bottom.CalcPosPoint() but didnt work.
Once you have the answer to b) you will be able to make the translation 'manually'.
c) Can I change the association of zoom from mouse left button to right button in a webchart ?
No, as the zoom again relies on IPostBackDataHandler.LoadPostData.

Posted: Tue Aug 01, 2006 1:50 pm
by 9531990
Hello am,

this:

Code: Select all

WebChart1.Style.Value.ToString()
returns a string containing x and y-value of the upper left corner of you webchart.

Posted: Tue Aug 01, 2006 3:49 pm
by 9525970
Hello Stark,

This code throws me a null pointer exception at the Value part.

Thanks



Hello am,

this:
Code:

WebChart1.Style.Value.ToString()


returns a string containing x and y-value of the upper left corner of you webchart.

Posted: Tue Aug 01, 2006 6:57 pm
by 9525970
Hello,

what do you mean by translating manually ? I have the X,Y screen coordinates now but having a hard time getting the equvivalent coordinates in the teechart coordinate space. The methods provided in the series object somehow dont work ?

thanks



Quote:
c) Can Teechart translate on screen X,Y location to x,y within the teechart coordinate system ? I tried tChart1.Axes.Bottom.CalcPosPoint() but didnt work.


Once you have the answer to b) you will be able to make the translation 'manually'.

Posted: Wed Aug 02, 2006 6:42 am
by 9531990
Hello am,


using this code I have no problems to ascertaining the x- and y-values:

Default.aspx.cs

Code: Select all

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Default : System.Web.UI.Page 
{
    String topY;
    String leftX;
    String topY1;
    String leftX1;
    String webchart;
    protected void Page_Load(object sender, EventArgs e)
    {
        Steema.TeeChart.Chart ch1 = WebChart1.Chart;
        ch1.Series[0].FillSampleValues();

        topY = ch1.Panel.ShapeBounds.Location.X.ToString();
        leftX = ch1.Panel.ShapeBounds.Location.Y.ToString();

        Label1.Text= WebChart1.Style.Value.ToString();
    }
    
}
Default.aspx

Code: Select all

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        &nbsp;<tchart:WebChart ID="WebChart1" runat="server" AutoPostback="False" Config="AAEAAAD/////AQAAAAAAAAAMAgAAAFJUZWVDaGFydCwgVmVyc2lvbj0yLjAuMjM1MS4xODk5NiwgQ3VsdHVyZT1uZXV0cmFsLCBQdWJsaWNLZXlUb2tlbj05YzgxMjYyNzZjNzdiZGI3DAMAAABRU3lzdGVtLkRyYXdpbmcsIFZlcnNp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AAAAoAAAAAAAAAACMAAQAB9P////X///8KAAAAAAAAAACNAAEAAAAAAAAAAAAAAAXz////IlN5c3RlbS5EcmF3aW5nLkRyYXdpbmcyRC5EYXNoU3R5bGUBAAAAB3ZhbHVlX18ACAMAAAABAAAAAAABAAAAAAAAAAAAAAHy////8////wEAAAAAAAEAAAAAAAAAAAAAAfH////z////AQAAAAAAAQAAAAAAAAAAAAAB8P////P///8BAAAAAAABAAAAAAAAAAAAAAHv////8////wEAAAAAAAEAAAAAAAAAAAAAAe7////z////AQAAAAAAAQHt////9f///woAAAAAAAAAAKQAAQAB7P////X///8KAAAAAAAAAAA0AAEAAAEF6////yZTeXN0ZW0uRHJhd2luZy5EcmF3aW5nMkQuU21vb3RoaW5nTW9kZQEAAAAHdmFsdWVfXwAIAwAAAAEAAACaAAAA0QAAAAAF6v///yVTeXN0ZW0uRHJhd2luZy5UZXh0LlRleHRSZW5kZXJpbmdIaW50AQAAAAd2YWx1ZV9fAAgDAAAAAAAAAAAAAAAAAAAAAAAAAACQAQAAAAAAAACQdUAAAAAAAJB1QCwBAAAAAQAAAAAJFwAAAAAADwYAAAAAAAAABg8HAAAAAAAAAAYRFwAAAAEAAAAGGAAAAAhUZWVDaGFydAs="
            GetChartFile="GetChart.aspx" TempChart="Session" style="left: 45px; position: static; top: 34px" Height="259px" Width="355px" />
        &nbsp;
        <asp:Label ID="Label1" runat="server" Height="45px" Text="Label" Width="137px"></asp:Label></div>
    </form>
</body>
</html>
This is just a simple website with a chart and label on it. I'm able to print the values in the label.