Page 1 of 1

Metafile height is always 65535

Posted: Tue Oct 05, 2010 2:56 pm
by 9639799
Hi

When I use the Metafile property of TChart I always get an image height of 65535 - regardless of the actual TChart size.
Any idea what could cause that?

The TeeChart version used is 2.0.2987.19069

Thank you for your help!

Best regards,
Manuel

Re: Metafile height is always 65535

Posted: Wed Oct 06, 2010 8:20 am
by 10050769
Hello Manuel,

I couldn't reproduce your problem using last version 2 and next code:

Code: Select all

     public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        Steema.TeeChart.Styles.Line series1;
        private void InitializeChart()
        {
            series1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
            series1.FillSampleValues();

            tChart1.Refresh();

            tChart1.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfOnly;
            tChart1.Export.Image.Metafile.Save("c:\\teeChartEmfOnly.emf");


            tChart1.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfPlusDual;
            tChart1.Export.Image.Metafile.Save("c:\\teeChartEmfPlusDual.emf");

            tChart1.Export.Image.Metafile.EMFFormat = System.Drawing.Imaging.EmfType.EmfPlusOnly;
            tChart1.Export.Image.Metafile.Save("c:\\teeChartEmfPlusOnly.emf"); 
         }
Could you please, check if previous code works fine for you?

Thanks,

Re: Metafile height is always 65535

Posted: Wed Oct 06, 2010 8:38 am
by 9639799
Hi Sandra

It seems, that the problem only occurs when a series contains values which would appear outside the chart's bounds. For example, if you add double.PositiveInfinite and double.NegativeInfinite values to an area series while setting the y-axis scale to 0...1 you should encounter the same issue.

Best regards,
Manuel

Re: Metafile height is always 65535

Posted: Wed Oct 06, 2010 11:09 am
by 10050769
Hello Manuel,

I could not reproduce it here with last version 2 of TeeChart.Net. Could you please, send us a simple example, because we can reproduce your problem exactly here?

Thanks,

Re: Metafile height is always 65535

Posted: Thu Oct 07, 2010 5:33 am
by 9639799
Hi Sandra
Please find attached a small project which demonstrates the issue.
Have fun! :D
Manuel

Re: Metafile height is always 65535

Posted: Thu Oct 07, 2010 9:43 am
by 10050769
Hello Manuel,

Thanks for your project. I can reproduce your problem with height in last version 2 but not in last version 4. I strongly recommend you to download the fully functional evaluation version available at http://www.steema.com/evaluation/net and check again if problem persist. Moreover, I suggest a workaround using BITMAP image that seems works correctly for version 2:

Code: Select all

public Form1()
        {
            InitializeComponent();
            InitializeChart();
            Debug.Assert(tChart1.Size.Equals(tChart1.Metafile.Size), "Size of the metafile is not equal to the chart size");
        }      
        private void InitializeChart()
        {
            bool bgEnabled = false;
            for (int i = 0; i < 4; i++)
            {
                TimeSpan t = new TimeSpan(0, 0, i);
                tChart1[0].Add(t.TotalDays, bgEnabled ? double.PositiveInfinity : double.NegativeInfinity);
                tChart1[1].Add(t.TotalDays, Math.Sin(i));
                bgEnabled = !bgEnabled;
            }
        }
I hope will helps.

Thanks,