Importing .ten in Web Charts causes Custom Axes to dissapear

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
ArcUsers
Newbie
Newbie
Posts: 8
Joined: Mon Jan 16, 2006 12:00 am

Importing .ten in Web Charts causes Custom Axes to dissapear

Post by ArcUsers » Fri Mar 16, 2012 3:18 pm

Good morning,

We currently have an application that generate a .ten from a Chart we use in our WinForm application. We have a little homemade Asp.Net application and we want to show the same Chart on it.

Unfortunately, when we Import the file, all of our custom axes are invisible.

We do not have that problem if we import the same file in the WinForm App. Would you know how to fix this problem?

It is now allowing me to upload one of the file I'm having trouble with, how can I provide you with one of my file?

Here is how I load it with Asp.NET

Page Load:

Code: Select all

protected void Page_Load(object sender, EventArgs e)
{
   //Crée notre Memory Stream
   try
   {
           MemoryStream ms = new MemoryStream(ApplicationHost.Instance.StreamChartProd);

           //Load le chart crée par le serveur
           ChartProd.Chart.Import.Template.Load(ms);
    }
    catch (IOException ex)
    {
         Server.Transfer("~/ErrorPages/MiseAJourEnCours.aspx");
     }
}
Chart Load:

Code: Select all

protected void ChartProd_Load(object sender, EventArgs e)
{
    //Vue qu'on importe le graphique, on doit rajouter les tools manuellement.
    Steema.TeeChart.Chart chart = ChartProd.Chart;
    Steema.TeeChart.Tools.ScrollTool scrollTool = new Steema.TeeChart.Tools.ScrollTool(chart);
    Steema.TeeChart.Tools.SeriesHotspot hotspot = new Steema.TeeChart.Tools.SeriesHotspot();

    //Permet d'afficher le tooltip custom
    hotspot.GetHTMLMap += new Steema.TeeChart.Tools.SeriesHotspotEventHandler(tooltip_GetHTMLMap);
    hotspot.MapAction = Steema.TeeChart.Styles.MapAction.Script;

    chart.Tools.Add(hotspot);

    //Le chart importer à juste une vision de 24 heures, nous on veut tout! 
    chart.Axes.Bottom.Minimum = DateTime.Now.AddHours(-25).ToOADate();
    chart.Axes.Bottom.Maximum = DateTime.Now.AddHours(37).ToOADate();

    //On va changer le background color du Chart.
    chart.Panel.Color = System.Drawing.Color.White;
    chart.Panel.Gradient.StartColor = System.Drawing.Color.White;
    chart.Panel.Gradient.EndColor = System.Drawing.Color.White;


    //On active le Scroll, on set la position de départ et la grosseur de vision qu'on veut
    // 24 heures / 72 heures = 1/3, donc ~ 30%
    ((Steema.TeeChart.Tools.ScrollTool)chart.Tools[0]).Active = true;
    ((Steema.TeeChart.Tools.ScrollTool)chart.Tools[0]).StartPosition = 25;
    ((Steema.TeeChart.Tools.ScrollTool)chart.Tools[0]).ViewSegmentSize = 35;

}

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

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by Sandra » Mon Mar 19, 2012 11:28 am

Hello ArcUsers,

I have made two projects using last version of TeeChartFor.Net, where is exported a Chart there is a custom axes to .ten file and after I import it.

In the first project I have made a simple sample using WebChart and export and Import .ten file works fine for me.
Web code:

Code: Select all

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Steema.TeeChart;
using System.Drawing;

public partial class _Default : System.Web.UI.Page 
{
    Steema.TeeChart.Chart tChart1;
    protected void Page_Load(object sender, EventArgs e)
    {
        tChart1 = WebChart1.Chart;
        InitializeChart();

    }
        private Steema.TeeChart.Axis axis1,axis2,axis3,axis4;
      private Steema.TeeChart.Styles.FastLine line1,line2,line3,line4;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            //InitializeSeries

            line1 = new Steema.TeeChart.Styles.FastLine(tChart1);
            line2 = new Steema.TeeChart.Styles.FastLine(tChart1);
            line3 = new Steema.TeeChart.Styles.FastLine(tChart1);
            line4 = new Steema.TeeChart.Styles.FastLine(tChart1);
            line1.FillSampleValues();
            line2.FillSampleValues();
            line3.FillSampleValues();
            line4.FillSampleValues();
            //InitializeAxes
            axis1 = new Steema.TeeChart.Axis(tChart1);
            axis2 = new Steema.TeeChart.Axis(tChart1);
            axis3 = new Steema.TeeChart.Axis(tChart1);
            axis4 = new Steema.TeeChart.Axis(tChart1);
            tChart1.Axes.Custom.Add(axis1);
            tChart1.Axes.Custom.Add(axis2);
            tChart1.Axes.Custom.Add(axis3);
            tChart1.Axes.Custom.Add(axis4);
            tChart1.Axes.Left.Visible = false;
         //   axis1.
            axis1.StartPosition = 0;
            axis1.EndPosition = 24;
            axis2.StartPosition = 25;
            axis2.EndPosition = 49;
            axis3.StartPosition = 50;
            axis3.EndPosition = 74;
            axis4.StartPosition = 75;
            axis4.EndPosition = 100;

            axis1.AxisPen.Color = Color.Red;
            axis2.AxisPen.Color = Color.Blue;
            axis3.AxisPen.Color = Color.Yellow;
            axis4.AxisPen.Color = Color.Black;

            //Assign Axes to Series
         line1.CustomVertAxis = axis2;
         line2.CustomVertAxis = axis1;
         line3.CustomVertAxis = axis3;
         line4.CustomVertAxis = axis4;

            tChart1.Panel.MarginLeft = 10;

            tChart1.Export.Template.Save(@"C:\Chart1.ten");

      }
     
       
    protected void  Button1_Click(object sender, EventArgs e)
    {
        tChart1.Series.Clear();
        tChart1.Import.Template.Load(@"C:\Chart1.ten");
    }

Second example, I have exported the Chart to .ten file in the WinForms application and I have Imported it in the ASP.net application and it works fine too.
WinForms code:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Steema.TeeChart.Styles;
using Steema.TeeChart;
using Steema.TeeChart.Functions;
using Steema.TeeChart.Drawing;


namespace GeneralTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
          private Steema.TeeChart.Axis axis1,axis2,axis3,axis4;
      private Steema.TeeChart.Styles.FastLine line1,line2,line3,line4;

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            //InitializeSeries
            line1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            line2 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            line3 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            line4 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
            line1.FillSampleValues();
            line2.FillSampleValues();
            line3.FillSampleValues();
            line4.FillSampleValues();
            //InitializeAxes
            axis1 = new Steema.TeeChart.Axis(tChart1.Chart);
            axis2 = new Steema.TeeChart.Axis(tChart1.Chart);
            axis3 = new Steema.TeeChart.Axis(tChart1.Chart);
            axis4 = new Steema.TeeChart.Axis(tChart1.Chart);
            tChart1.Axes.Custom.Add(axis1);
            tChart1.Axes.Custom.Add(axis2);
            tChart1.Axes.Custom.Add(axis3);
            tChart1.Axes.Custom.Add(axis4);
            tChart1.Axes.Left.Visible = false;
         //   axis1.
            axis1.StartPosition = 0;
            axis1.EndPosition = 24;
            axis2.StartPosition = 25;
            axis2.EndPosition = 49;
            axis3.StartPosition = 50;
            axis3.EndPosition = 74;
            axis4.StartPosition = 75;
            axis4.EndPosition = 100;

            axis1.AxisPen.Color = Color.Red;
            axis2.AxisPen.Color = Color.Blue;
            axis3.AxisPen.Color = Color.Yellow;
            axis4.AxisPen.Color = Color.Black;

            //Assign Axes to Series
         line1.CustomVertAxis = axis2;
         line2.CustomVertAxis = axis1;
         line3.CustomVertAxis = axis3;
         line4.CustomVertAxis = axis4;

            tChart1.Panel.MarginLeft = 10;

            tChart1.Export.Template.Save(@"C:\Chart1.ten");

      }
}
}
Web code:

Code: Select all

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

    }
    private void InitializeChart()
    {
        WebChart1.Chart.Import.Template.Load(@"tChart1.ten");
    }
Can you please, check if previous examples works fine for you? If it doesn't work as you expect, can you tell us which version are you using of TeeChartFor.Net?

Thanks,
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

ArcUsers
Newbie
Newbie
Posts: 8
Joined: Mon Jan 16, 2006 12:00 am

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by ArcUsers » Wed Mar 21, 2012 8:29 pm

Good evening,

Sorry for the delay, I had to deal with some other issues!

I have tried both example, and they are working just fine. I probably should have been a bit more clearer on my first post, given that I was a bit in a hurry!

Let's see... I am using TeeChart v4.1.2012.02280.

The issue is very odd.
We'll export the Chart from our WinForm Application. If I reimport the chart inside the WinForm application, my CustomAxes are still visible. Even with a new WinForm project and a blank TeeChart, if I import the file the CustomAxes will be visible.

However, if I import it on my Asp.Net Application, the Custom Axis will not be visible.
It's pretty odd because all of the series are still bound to them, and everything shows and nothing is out of place except for the fact that I can't see the Axis and its labels...
I figured I might be doing something stupid, and used a Breakpoint when the Chart is loading to check if my customAxes are Visible = False.
But they aren't, their Visible proprety is set to True.

I did some more investigation, and tried importing my chart on a clean Asp.Net Application and what do you know, the CustomAxes were visible!
Which means something I am doing causes the CustomAxes to disspear...

After a bit of tweaking around, I found out that if I add a ScrollTool to my graph, then my customAxis dissapear. And once again, my CustomAxes.Visible is set to True.

Good news is that I managed to replicate the problem on a small scale!

Here is the code to reproduce the problem, you have to generate the Chart1 file from either the WinForm or Asp.Net.

Code: Select all

public partial class _Default : System.Web.UI.Page
{
        Steema.TeeChart.Chart tChart1;
        protected void Page_Load(object sender, EventArgs e)
        {
            tChart1 = WebChart1.Chart;
            tChart1.Import.Template.Load(@"C:\Chart1.ten");

        }

protected void WebChart1_Load(object sender, EventArgs e)
        {
            tChart1 = WebChart1.Chart;
            Steema.TeeChart.Tools.ScrollTool scrollTool = new Steema.TeeChart.Tools.ScrollTool(tChart1);

            tChart1.Axes.Bottom.Minimum = -50;
            tChart1.Axes.Bottom.Maximum = 50;

            ((Steema.TeeChart.Tools.ScrollTool)tChart1.Tools[0]).Active = true;
            ((Steema.TeeChart.Tools.ScrollTool)tChart1.Tools[0]).StartPosition = 25;
            ((Steema.TeeChart.Tools.ScrollTool)tChart1.Tools[0]).ViewSegmentSize = 25;
        }
}
You will notice that the CustomAxes are invisible, but the series still visible.

Let me know if you manage to find a work around or if I am doing something horribly wrong! :)

Sorry for the wall of text!

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

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by Sandra » Thu Mar 22, 2012 10:48 am

Hello ArcUsers,

Thanks for your information. I inform you that is a limitation of WebChart when use Scroll tool and custom axes. It is already added in wish-list with number [TW77014355]. We will try to consider its inclusion in futures versions of TeeChartFor .Net.

Thanks,
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

ArcUsers
Newbie
Newbie
Posts: 8
Joined: Mon Jan 16, 2006 12:00 am

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by ArcUsers » Thu Mar 22, 2012 12:57 pm

Are there any known work around for this issue?

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

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by Sandra » Fri Mar 23, 2012 11:21 am

Hello ArcUsers,

At the moment, I don't have any workaround but I have increased the severity of the bug. On the other hand, if we find some workaround we inform you immediately.

Thanks,
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

ArcUsers
Newbie
Newbie
Posts: 8
Joined: Mon Jan 16, 2006 12:00 am

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by ArcUsers » Mon Apr 09, 2012 2:46 pm

Hello!

I thought I would post an update as to how I worked around the issue.

Since we're not allowing any zoom on the Web Interface, all we needed was an image of the Axis to sit to the left and the right of the WebChart.
So we put the WebChart in a table, added a column on each side and played with their margin to place them in the right position. I also upped their Z-Index to make sure they are on top since the WebChart has a little left and right margin.

The result gives something like this:

Code: Select all

<table cellspacing="0" cellpadding="0">
            <tr>
                <td valign="top">
                    <img style="margin-right: -11px; z-index: 9999; position: absolute;" src="Images/gaucheTrains.png" />
                </td>
                <td width="1100">
                    <tchart:WebChart ID="ChartTrains" runat="server" TempChart="Session" AutoPostback="True"
                        GetChartFile="GetChart.aspx" Height="700px" OnGetAxisLabel="ChartTrains_GetAxisLabel"
                        OnLoad="ChartTrains_Load" Width="1100px" />
                </td>
                <td valign="top">
                    <img style="margin-left: -11px; z-index: 9999;position: absolute;" src="Images/droiteTrains.png" />
                </td>
            </tr>
</table>
You'd probably have to play around with the margin a bit in other browsers maybe, but this seems to work everywhere I tried. I'm not exactly proud to have duct'd taped this solution together but it seems to be working and it's not a huge bad practice.

Hopefully your guys can resolve the issue eventually, for now we have worked around the issue!

Happy Easter!

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

Re: Importing .ten in Web Charts causes Custom Axes to dissapear

Post by Sandra » Tue Apr 10, 2012 2:22 pm

Hello ArcUsers,

Thanks for your information. This will be very helpfull for us and I have added in the bug number[TW77014355].

Thanks,
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

Post Reply