Problem with metafile (EMF and WMF)
Problem with metafile (EMF and WMF)
Hello,
First, I have to admit that I'm still using TeeChart v5 - it does everything I want it to do (until now) so never felt the need to upgrade. But maybe someone recognises my current problem and has, being cleverer than I, come with a solution.
The story: I have a TChart with one TLineSeries, I copy this to the clipboard in EMF format (or WMF it makes no difference) and paste it in Word or PowerPoint (Office 2003). The paste works fine but when I do Ungroup on the pasted chart the plot itself (i..e the line series) disappears and becomes something small stuck away at the left-hand side of the chart.
Now the really strange bit: this doesn't always happen, sometimes Ungroup works just fine and the line series stays where it should be, ungrouped and all.
I've played with scales, colours etc but haven't been able to find a pattern as yet and am running out of ideas.
So, if anyone has a hint, a suggestion or (even better) a solution, I'd be most grateful.
Regards,
Dag Hovden
First, I have to admit that I'm still using TeeChart v5 - it does everything I want it to do (until now) so never felt the need to upgrade. But maybe someone recognises my current problem and has, being cleverer than I, come with a solution.
The story: I have a TChart with one TLineSeries, I copy this to the clipboard in EMF format (or WMF it makes no difference) and paste it in Word or PowerPoint (Office 2003). The paste works fine but when I do Ungroup on the pasted chart the plot itself (i..e the line series) disappears and becomes something small stuck away at the left-hand side of the chart.
Now the really strange bit: this doesn't always happen, sometimes Ungroup works just fine and the line series stays where it should be, ungrouped and all.
I've played with scales, colours etc but haven't been able to find a pattern as yet and am running out of ideas.
So, if anyone has a hint, a suggestion or (even better) a solution, I'd be most grateful.
Regards,
Dag Hovden
Re: Problem with metafile (EMF and WMF)
Hi Dag,
I'm not sure to understand how do you exactly set your chart. What do you mean with "Ungroup".
It would be helpful if you could find a way to reproduce the problem consistently and if you could send us a simple example project we can run as-is to reproduce the problem here.
I'm not sure to understand how do you exactly set your chart. What do you mean with "Ungroup".
It would be helpful if you could find a way to reproduce the problem consistently and if you could send us a simple example project we can run as-is to reproduce the problem here.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with metafile (EMF and WMF)
Hello,
"Ungroup" is what you can do in MS-Word (or PowerPoint or any Office app), after pasting. For a metafile, like EMF/WMF, the pasted chart is then split up in its component part: labels, axes, data trace, etc and you can edit stuff: change position, font, colour, etc - pretty useful for the end user.
The problem is that in some cases the data trace just disappears (or gets really small) after Ungroup, as if Word somehow messes up the relation between the trace and the X and Y axes.
I'll see if I can come up with a test-project that demonstrates the problem. What makes it awkward it that it isn't consistent, sometimes Ungroup works OK, sometimes not. Producing a project that consistently fails is probably not so easy.
Regards,
Dag Hovden
"Ungroup" is what you can do in MS-Word (or PowerPoint or any Office app), after pasting. For a metafile, like EMF/WMF, the pasted chart is then split up in its component part: labels, axes, data trace, etc and you can edit stuff: change position, font, colour, etc - pretty useful for the end user.
The problem is that in some cases the data trace just disappears (or gets really small) after Ungroup, as if Word somehow messes up the relation between the trace and the X and Y axes.
I'll see if I can come up with a test-project that demonstrates the problem. What makes it awkward it that it isn't consistent, sometimes Ungroup works OK, sometimes not. Producing a project that consistently fails is probably not so easy.
Regards,
Dag Hovden
Re: Problem with metafile (EMF and WMF)
Hi Dag,
I've found the unGroup button but it is unavailable for me while the image is selected: Am I doing something wrong?
I've found the unGroup button but it is unavailable for me while the image is selected: Am I doing something wrong?
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with metafile (EMF and WMF)
Hello Yeray,
"I've found the unGroup button but it is unavailable for me while the image is selected:"
That is strange because I get this (after paste and select image):
Regards,
Dag
"I've found the unGroup button but it is unavailable for me while the image is selected:"
That is strange because I get this (after paste and select image):
Regards,
Dag
Re: Problem with metafile (EMF and WMF)
Hi Dag,
We've seen that your chart seems to be pasted into some other object, maybe a TextBox?
I've inserted a TextBox and pasted the chart into it. Then, in the TextBox contextual menu (not in the Chart image contextual menu) I can see the Group submenu, but all the buttons in it are grayed.
Could you please explain how do you exactly paste the image?
Here is the code I'm using to generate the chart:
We've seen that your chart seems to be pasted into some other object, maybe a TextBox?
I've inserted a TextBox and pasted the chart into it. Then, in the TextBox contextual menu (not in the Chart image contextual menu) I can see the Group submenu, but all the buttons in it are grayed.
Could you please explain how do you exactly paste the image?
Here is the code I'm using to generate the chart:
Code: Select all
uses series;
procedure TForm1.FormCreate(Sender: TObject);
begin
with Chart1.AddSeries(TLineSeries) do
FillSampleValues();
Chart1.CopyToClipboardMetafile(false);
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with metafile (EMF and WMF)
Well, it's all pretty straightforward:
after the Copy (in my own app, using EMF), I switch to Word (2003, blank document), press Ctrl-V. Next I right-click the pasted metafile, select "Edit Picture" in the menu (after which the pasted chart has a frame) and then right-click again and select "Grouping" followed by "Ungroup". After the Ungroup, sometimes all is well, sometimes the trace itself disappears.
Regards,
Dag
after the Copy (in my own app, using EMF), I switch to Word (2003, blank document), press Ctrl-V. Next I right-click the pasted metafile, select "Edit Picture" in the menu (after which the pasted chart has a frame) and then right-click again and select "Grouping" followed by "Ungroup". After the Ungroup, sometimes all is well, sometimes the trace itself disappears.
Regards,
Dag
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Problem with metafile (EMF and WMF)
Hi Dag,
I can not reproduce this here using Word 2007. Should I repeat the process many times or try with many different new documents? I'm wondering if it's a Word issue. Do you have any other Word version at hand?
Thanks in advance.
I can not reproduce this here using Word 2007. Should I repeat the process many times or try with many different new documents? I'm wondering if it's a Word issue. Do you have any other Word version at hand?
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: Problem with metafile (EMF and WMF)
Hi Dag,
I could reproduce it with a FastLineSeries instead of a LineSeries so I've added it to the defect list to be fixed in future releases (TV52015143).
So a workaround for you could be using a LineSeries.
I could reproduce it with a FastLineSeries instead of a LineSeries so I've added it to the defect list to be fixed in future releases (TV52015143).
So a workaround for you could be using a LineSeries.
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Problem with metafile (EMF and WMF)
Hello,
"So a workaround for you could be using a LineSeries."
Ah, that's good. I'm using FastLineSeries because I've got lots of data to plot but I'll test and see if LineSeries could be used as well.
Anyway, thanks for your efforts.
Regards,
Dag
"So a workaround for you could be using a LineSeries."
Ah, that's good. I'm using FastLineSeries because I've got lots of data to plot but I'll test and see if LineSeries could be used as well.
Anyway, thanks for your efforts.
Regards,
Dag
Re: Problem with metafile (EMF and WMF)
Hi Dag,
We usually recommend FastLine instead of Line series when many points needs to be drawn as fastest as possible. But sometimes the extra features the Line series has are also needed.
To optimize the speed of your charts, you could try to implement as many tips as possible from the explained in the VCL Real-Time article here. And also here it is a .NET example:
We usually recommend FastLine instead of Line series when many points needs to be drawn as fastest as possible. But sometimes the extra features the Line series has are also needed.
To optimize the speed of your charts, you could try to implement as many tips as possible from the explained in the VCL Real-Time article here. And also here it is a .NET example:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
int nrOfSamples = 10000;
private Steema.TeeChart.Styles.FastLine fastline1;
private Steema.TeeChart.Styles.FastLine fastline2;
private System.Diagnostics.Stopwatch stopWatch;
private void InitializeChart()
{
stopWatch = new System.Diagnostics.Stopwatch();
tChart1.Aspect.View3D = false;
tChart1.Aspect.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
fastline1 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
fastline2 = new Steema.TeeChart.Styles.FastLine(tChart1.Chart);
//pre-assign ChartPens
Pen rPen = new Pen(Color.Red);
Pen bPen = new Pen(Color.Blue);
Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);
Steema.TeeChart.Drawing.ChartPen bluePen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, bPen);
fastline1.LinePen = redPen;
fastline2.LinePen = bluePen;
fastline1.FillSampleValues(nrOfSamples);
fastline2.FillSampleValues(nrOfSamples / 2);
//tChart1.Axes.Left.SetMinMax(-5.0, 5.0);
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
//calculate elapsed time
//stopWatch.Stop();
TimeSpan elapsedTime = stopWatch.Elapsed;
string total = elapsedTime.TotalSeconds.ToString();
label1.Text = "Elapsed time: " + total + " s";
}
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
stopWatch.Reset();
stopWatch.Start();
tChart1.AutoRepaint = false;
double[] x1 = new double[nrOfSamples];
for (int i = 0; i < x1.Length; i++)
{
x1[i] = i;
}
double[] x2 = new double[nrOfSamples / 2];
for (int i = 0; i < x2.Length; i++)
{
x2[i] = i;
}
double[] random1 = new double[nrOfSamples];
double[] random2 = new double[nrOfSamples / 2];
for (int i = 0; i < 100; i++)
{
FillArray(random1);
FillArray(random2);
fastline1.Add(x1, random1);
fastline2.Add(x2, random2);
tChart1.AutoRepaint = true;
//tChart1.Refresh();
Application.DoEvents();
}
stopWatch.Stop();
button1.Enabled = true;
}
private static void FillArray(double[] myArray)
{
Random y = new Random();
for (int i = 0; i < myArray.Length; i++)
{
myArray[i] = y.Next();
}
}
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |