Hi,
After a few years of succesfully developing using your teechart activeX, I am now looking at some strange behavior that I do not understand.
I create a simple chart like this in Visual Foxpro using your ActiveX.
1)
I dropped an instance of the teechart activeX to my form and just create a simple bar serie in it with some sample values in the form's init.
ThisForm.oChart.AddSeries(1)
ThisForm.oChart.Series(0).FillSampleValues(10)
2)
In the OnAfterDraw event I add some custom drawings on top of the series to the canvas.
This.Canvas.Font.Name = "Verdana"
This.Canvas.Font.Size = 16
This.Canvas.Font.Color = 0
X = This.Series(0).CalcXPosValue(4)
Y = This.Series(0).CalcYPosValue(300)
This.Canvas.TextOut(X, Y, "What's wrong")
When I run my form It shows everything I expected.
3)
I want to export this chart, so I use the following command in a button.
ThisForm.oChart.Export.SaveToJPEGFile("c:\test.jpg",.F.,100,100,800, 600)
This command does not export my custom drawings added to the canvas.
I also tried a
ThisForm.ocHART.Repaint()
ThisForm.oChart.Environment.InternalRepaint()
Before my export call but this also does not work...
I'm very frustrated right now as I have a deadline by tomorrow and have no clue how I can fix this.
I already downloaded the latest version of Teechart 7 but no success.
I also tried it with the Teechart 8 evaluation, but no success either.
Could someone please tell me what I am doing wrong or maybe it's considered a Bug.
Am willing to upgrade my Teechart 7 license to version 8 if it's nescessary, but I have to be certain that this problem is fixed then.
Hope someone can help me.
Regards, Jacques
Canvas drawing not exporting
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jacques,
Running the example here works fine for me using latest v7 and v8 releases. Could you please check if that works fine for you?
Running the example here works fine for me using latest v7 and v8 releases. Could you please check if that works fine for you?
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 |
Hi Narcís,
I already saw that post and tried that, actually I spend last 2 days checking for a solution, looking in these forums and trying some things myself.
Even with the simplest example it's not exporting the custom drawings added to the canvas.
If you read my post You will see that I do exactly the same as the post you send me to... The chart object that is added to my form shows the custom drawings, but as soon as I call
Chart.Export.SaveToJPEGFile("c:\test.jpg",.F.,100,100,800, 600)
The drawings disappear and have no drawings in my exported jpg.
I already tried to implement the Chart.Environment.InternalRepaint()
But this not solve the issue when exporting, it still removes my custom drawing and exports just the series.
Hope you can tell me what the heck I'm doing wrong, maybe it has something to do with Vista ?
Regards
Jacques
I already saw that post and tried that, actually I spend last 2 days checking for a solution, looking in these forums and trying some things myself.
Even with the simplest example it's not exporting the custom drawings added to the canvas.
If you read my post You will see that I do exactly the same as the post you send me to... The chart object that is added to my form shows the custom drawings, but as soon as I call
Chart.Export.SaveToJPEGFile("c:\test.jpg",.F.,100,100,800, 600)
The drawings disappear and have no drawings in my exported jpg.
I already tried to implement the Chart.Environment.InternalRepaint()
But this not solve the issue when exporting, it still removes my custom drawing and exports just the series.
Hope you can tell me what the heck I'm doing wrong, maybe it has something to do with Vista ?
Regards
Jacques
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jacques,
I don't think it has anything to do with Windows Vista. It works fine for me here using latest TeeChart Pro v8 ActiveX release. Is your code similar to this?
I don't think it has anything to do with Windows Vista. It works fine for me here using latest TeeChart Pro v8 ActiveX release. Is your code similar to this?
Code: Select all
BOOL CV8ExampleDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_Chart1.AddSeries(scSurface);
m_Chart1.Series(0).FillSampleValues(50);
return TRUE; // return TRUE unless you set the focus to a control
}
void CV8ExampleDlg::OnButton1()
{
m_Chart1.GetExport().SaveToJPEGFile("C:\\temp\\vccimage.jpg", FALSE, jpegBestQuality, 95, 400, 400);
}
void CV8ExampleDlg::OnOnAfterDrawTchart1()
{
m_Chart1.GetCanvas().GetFont().SetName("Verdana");
m_Chart1.GetCanvas().GetFont().SetSize(16);
m_Chart1.GetCanvas().GetFont().SetColor(RGB(0,0,255));
m_Chart1.GetCanvas().TextOut(200, 200, "Hello!");
}
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 |
Hi Yes something like that...
On my form containing the chart control I see it draws the text from the OnAfterDraw event however as soon as I call SavetoJpegfile
This drawing disappears from my form and it exports without the drawing.
As I said I already tried the InternalRepaint / Repaint before the SavetoJpeg call but this does not solve anything.
Hope you can help me solve this problem.
Regards
Jacques
BTW using OCX version 7.0.1.4
On my form containing the chart control I see it draws the text from the OnAfterDraw event however as soon as I call SavetoJpegfile
This drawing disappears from my form and it exports without the drawing.
As I said I already tried the InternalRepaint / Repaint before the SavetoJpeg call but this does not solve anything.
Hope you can help me solve this problem.
Regards
Jacques
BTW using OCX version 7.0.1.4
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello Jacques,
Same code works fine for me here using v7.0.1.4 without the need of calling InternalRepaint method.
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
Same code works fine for me here using v7.0.1.4 without the need of calling InternalRepaint method.
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
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 |
Hi Narcis,
I just uploaded an example form written in Visual Foxpro (8 or higher)
it's a test form, if you just run the form and click the export button I get the jpg that is also in the zip file I uploaded.
I uploaded a file called test.zip
Hope you can reproduce and then solve the problem.
Regards
Jacques Herweijer
I just uploaded an example form written in Visual Foxpro (8 or higher)
it's a test form, if you just run the form and click the export button I get the jpg that is also in the zip file I uploaded.
I uploaded a file called test.zip
Hope you can reproduce and then solve the problem.
Regards
Jacques Herweijer
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jacques,
Thanks for the example project. We could reproduce the issue here.
We don't have much experience using VFP. Could you please try generating project's .exe file and check if it works running the .exe?
Thanks in advance.
Thanks for the example project. We could reproduce the issue here.
We don't have much experience using VFP. Could you please try generating project's .exe file and check if it works running the .exe?
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 |
Hi Narcís,
I tried it running from exe, but same issue remains.
As my customer had a deadline I was now forced to use some other charting solution.
I now use the new charting tools that come from Microsoft Visual studio 2008 for my charts where I need to add custom drawings, so this is not such a hot issue anymore. Nevertheless, I still hope you can fix the problem.
Regards,
Jacques
I tried it running from exe, but same issue remains.
As my customer had a deadline I was now forced to use some other charting solution.
I now use the new charting tools that come from Microsoft Visual studio 2008 for my charts where I need to add custom drawings, so this is not such a hot issue anymore. Nevertheless, I still hope you can fix the problem.
Regards,
Jacques