Page 1 of 1

some questions about TeeChart

Posted: Mon Jan 21, 2013 9:34 am
by 15656007
when we use the Teechart there is some questions can you help me? please see the Attachment thanks!

Re: some questions about TeeChart

Posted: Mon Jan 21, 2013 2:55 pm
by 10050769
Hello Candy,
Can I Marquee the chart and get the Sequence data (please see the picturec)?
I want to get this data and draw a new chart how can I do
If you want get the values of a determinate selection values. I recommend you taking a look in this link where are discussing about this topic. If you have any problems, please let me know.
2:dose Teechart support this Type of Chart? Thanks!
Yes, I recommend you taking a look in the All features\Welcome !\Chart styles\Financial\Point and Figure to know as you do to create this type of Financial Charts.

Re: some questions about TeeChart

Posted: Tue Jan 22, 2013 3:14 am
by 15656007
is there any sample about web chart about this? thanks! :D

Re: some questions about TeeChart

Posted: Tue Jan 22, 2013 1:47 pm
by 10050769
Hello Candy,

I have made for you a simple code using the rectangle of ZoomTool to get the data sequence value using web chart.

Code: Select all

  private Steema.TeeChart.Tools.ZoomTool tool1;
   private System.IO.MemoryStream tmpChart;
    protected void Page_Load(object sender, System.EventArgs e)
    {
        Steema.TeeChart.Chart ch1 = WebChart1.Chart;
        tmpChart = new System.IO.MemoryStream();
        if (Session["ch1"] == null)
        {
            ch1.AutoRepaint = false;
            ch1.Aspect.View3D = false;
           //Tool Zoom
            ch1.Tools.Add(new Steema.TeeChart.Tools.ZoomTool(WebChart1.Chart));
            tool1.ZoomPenColor = System.Drawing.Color.OliveDrab;
            ch1.Panel.Gradient.Visible = false;
            ch1.Walls.Visible = false;
            
            ch1.Series.Add(new Steema.TeeChart.Styles.Points());
            ch1.Series.Add(new Steema.TeeChart.Styles.Points());
            ch1[0].FillSampleValues();
            ch1[1].FillSampleValues();
            ch1.Export.Template.Save(tmpChart);
            //save template to a Session variable
            Session.Add("ch1", tmpChart);
        }
        else
        {
            //retrieve the session stored Chart
            tmpChart = (System.IO.MemoryStream)Session["ch1"];
            //set the Stream position to 0 as the last read/write
            //will have moved the position to the end of the stream
            tmpChart.Position = 0;
            //import saved Chart
            WebChart1.Chart.Import.Template.Load(tmpChart);
            System.Drawing.Bitmap bmp = WebChart1.Chart.Bitmap((int)WebChart1.Width.Value, (int)WebChart1.Height.Value);
            myMethod();
            //If you want use zoom you only need uncoment CheckZoom
           // CheckZoom(WebChart1); 
        }
    }
    //Use My method to get the rectangle zoom coordinates. 
    private void myMethod()
    {
        Hashtable ht = getZoomArgs(Request);
        int X0 = Convert.ToInt32(ht["x0"]);
        int Y0 = Convert.ToInt32(ht["y0"]);
        int X1 = Convert.ToInt32(ht["x1"]);
        int Y1 = Convert.ToInt32(ht["y1"]);
        ListBox1.Items.Clear();
        if ((X0 != -1) && (Y0 != -1))
        {
            foreach (Steema.TeeChart.Styles.Series s in WebChart1.Chart.Series)
            {
                for (int i = 0; i < s.Count; i++)
                {
                    if (CheckSeriesPoints(s, i, X0, Y0, X1, Y1))
                    {
                        ListBox1.Items.Add("Series:"+s.Title+"Point " + i.ToString() + ": " + s.XValues[i].ToString() +
                                                      ", " + s.YValues[i].ToString());
                    }
                }
            }
        }
    }
    //CheckSeriesPoint is in the rectangle or not. 
    private bool CheckSeriesPoints(Steema.TeeChart.Styles.Series s, int index, int X0,int Y0, int X1, int Y1)
    {
        return ((s.CalcXPos(index) >= X0) && (s.CalcXPos(index) <= X1) && (s.CalcYPos(index) >= Y0) && (s.CalcYPos(index) <= Y1));

    }
    //Do zoom. 
    private void CheckZoom(Steema.TeeChart.Web.WebChart wChart)
    {
        System.Collections.ArrayList zoomedState = (System.Collections.ArrayList)Session[Request.QueryString["filename"] + "Zoomed"];
        System.Drawing.Bitmap bmp = WebChart1.Chart.Bitmap((int)wChart.Width.Value, (int)wChart.Height.Value);

        if (wChart.Chart.Tools.Count > 0)
        {
           zoomedState = ((Steema.TeeChart.Tools.ZoomTool)wChart.Chart.Tools[0]).SetCurrentZoom(Request, zoomedState);
            if (zoomedState != null)
            {

                Session.Add(Request.QueryString["filename"] + "Zoomed", zoomedState);
            }
            else
                Session.Remove(Request.QueryString["filename"] + "Zoomed");
        }
    }
    //Need to get arguments of Zoom tool to allow you calculate rectangle.
    protected Hashtable getZoomArgs(HttpRequest r)
    {
        Hashtable argumentList = new Hashtable();
        if ((r.Params["__EVENTARGUMENT"] != null) && (r.Params["__EVENTARGUMENT"].Length > 0))
        {
            char[] pairs = new char[1] { ';' };
            char[] vals = new char[1] { '$' };

            String[] varpairs = r.Params["__EVENTARGUMENT"].Split(pairs);

            foreach (string s in varpairs)
                if (s.IndexOf("$") != -1)
                    argumentList.Add(s.Split(vals)[0], s.Split(vals)[1]);
        }

        return argumentList;
    }
Could you tell us if previous code help you?

On the other hand, if you want know as you do to create Point and Figure Financial Chart using TeeChartFor.Net Asp Chart I recommend taking a look in Chart Styles\ Financial\Point and Figure example of Demo Asp.

I hope will helps.

Thanks,