Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ScatterDraw & ScatterCtrl » PieCtrl and GetImage (How to use correctly GetImage() with PieCtrl to obtain a image of the chart)
icon9.gif  PieCtrl and GetImage [message #49093] Sat, 16 December 2017 23:51 Go to next message
Diego22 is currently offline  Diego22
Messages: 10
Registered: November 2016
Location: Zaragoza
Promising Member
Hi,

I've been trying to use GetImage() with PieCtrl for several days but I haven't get the image of the pie chart. I want to use that image in a pdf report, for this, I'm using "PlaceImage()".
If I try to convert to string, it shows img(0, 0).

What am I doing wrong?

Thanks in advance.

Regards.
Re: PieCtrl and GetImage [message #49102 is a reply to message #49093] Mon, 18 December 2017 13:56 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Dear Diego

Thank you for the report. Some fixes and improvements have been uploaded.
From now on you can use GetImage(). In addition, menu has been added including copying to clipboard and saving to image file.


Best regards
Iñaki
Re: PieCtrl and GetImage [message #49117 is a reply to message #49102] Tue, 19 December 2017 20:16 Go to previous messageGo to next message
Diego22 is currently offline  Diego22
Messages: 10
Registered: November 2016
Location: Zaragoza
Promising Member
I've just downloaded last version of theIDE but it still have not showed the pie. I've selected PieCtrl in the Layout window and part of the code is: (grafCostes is PieCtrl)

grafCostes.AddCategory ("FV Panels", CostFV, :: Color (242, 242, 11));
grafCostes.AddCategory ("Inverter + FV Regulator", CostInvReg, :: Color (255, 128, 0));
grafCostes.AddCategory ("Wind turbine + Inverter", CosteEolica, :: Color (0, 204, 204));
grafCostes.AddCategory ("Batteries", CosteAcum, :: Color (102, 204, 0));
grafCostes.AddCategory ("Generator", CosteDiesel, :: Color (178, 102, 255));

grafCostes.SetColor (Null) .SetPieMarginTop (10) .SetPieMarginBottom (10) .SetPieMarginLeft (1) .SetPieMarginRight (400);

grafCostes.SetCatValue (0, CostFV);
grafCostes.SetCatValue (1, CosteInvReg);
grafCostes.SetCatValue (2, CosteEolica);
grafCostes.SetCatValue (3, CosteAcum);
grafCostes.SetCatValue (4, CostDiesel);

imgCostes = grafCostes.GetImage (); //(Image imgCostes)

r.PlaceImage ("##IMG10", results.imgCost, Size (2000, 2000)); //(RepGen r)

Some help please.
Re: PieCtrl and GetImage [message #49118 is a reply to message #49117] Tue, 19 December 2017 21:12 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

I just noticed that bazzar/PieTest example doesn't compile due to lack of Scatter package. Can you take care of this problem Koldo?

@Dieggo
In my opinion your problem might be the result of lack appropriate inclusion before including LAYOUTFILE. It should be done something like that:
#include <Scatter/Pie.h> // This include doesn't exist - you need to find appropriate file or wait until Koldo fix PieTest.
#include <Report/Report.h>
#include <PdfDraw/PdfDraw.h>

#define LAYOUTFILE <PieTest/PieTest.lay>
#include <CtrlCore/lay.h>


Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Tue, 19 December 2017 21:15]

Report message to a moderator

Re: PieCtrl and GetImage [message #49121 is a reply to message #49118] Wed, 20 December 2017 11:50 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Dear Diego and Klugier

I will try to answer you.

Please Diego: Could you confirm that Examples\ScatterCtrl_Demo compiles and runs perfectly?

To include PieCtrl in your package you would need to include ScatterCtrl package and include
#include <ScatterCtrl/ScatterCtrl.h>
#include <ScatterCtrl/PieCtrl.h>

Diego please include this to see if you get the image. Just in case you may comment out everything but the AddCategory() (like in ScatterCtrl_Demo):
imgCostes = grafCostes.GetImage(); 
PNGEncoder encoder;
encoder.SaveFile("Any folder\\myfile.png", imgCostes);

Following Diego answer I understand that layout editor shows the PieCtrl. This way I can imagine ScatterCtrl package is really well loaded.

About bazaar/PieTest, this package and Scatter are not maintained. It was the base of ScatterCtrl/PieCtrl. However ScatterCtrl and ScatterDraw include all necessary stuff and are not linked in any way with Scatter package.


Best regards
Iñaki
Re: PieCtrl and GetImage [message #49123 is a reply to message #49121] Wed, 20 December 2017 13:57 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

So when bazaar/PieTest is not maintanence we should delete it from the bazzar. The package that doesn't compile has no value. Do you remote it Koldo or should I do it by myself?

Sincerely,
Klugier


U++ - one framework to rule them all.
Re: PieCtrl and GetImage [message #49127 is a reply to message #49093] Thu, 21 December 2017 12:25 Go to previous messageGo to next message
Diego22 is currently offline  Diego22
Messages: 10
Registered: November 2016
Location: Zaragoza
Promising Member
Quote:
In my opinion your problem might be the result of lack appropriate inclusion before including LAYOUTFILE. It should be done something like that:
#include <Scatter/Pie.h> // This include doesn't exist - you need to find appropriate file or wait until Koldo fix PieTest.
#include <Report/Report.h>
#include <PdfDraw/PdfDraw.h>

#define LAYOUTFILE <PieTest/PieTest.lay>
#include <CtrlCore/lay.h>


I`ve already included those includes. Maybe a correct Pie.h can help me.

Quote:
Please Diego: Could you confirm that Examples\ScatterCtrl_Demo compiles and runs perfectly?


ScatterCtrl compiles and runs correctly. But in Pie Tab, the functions about copy, print and png / jpg, are showing a error message.

Quote:

To include PieCtrl in your package you would need to include ScatterCtrl package and include
#include <ScatterCtrl/ScatterCtrl.h>
#include <ScatterCtrl/PieCtrl.h>

Following Diego answer I understand that layout editor shows the PieCtrl. This way I can imagine ScatterCtrl package is really well loaded.


Also, I had included those includes, layout editor shows the PieCtrl in context menu and the Pie picture at widget.

Quote:
Diego please include this to see if you get the image. Just in case you may comment out everything but the AddCategory() (like in ScatterCtrl_Demo):
imgCostes = grafCostes.GetImage(); 
PNGEncoder encoder;
encoder.SaveFile("Any folder\\myfile.png", imgCostes);


I added that code yesterday but I still can't get the image.
When I get home, I'll try to create a new and simply test of the Pie, so I'll see if the problem is not my code.
Re: PieCtrl and GetImage [message #49128 is a reply to message #49127] Thu, 21 December 2017 21:36 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Dear Diego

Please do not include #include <Scatter/Pie.h>. It has nothing to do with PieCtrl.

I advise you just to copy PieCtrl test in your code including PNGEncoder example I have enclosed you in previous posts.


Best regards
Iñaki

[Updated on: Thu, 21 December 2017 21:36]

Report message to a moderator

Re: PieCtrl and GetImage [message #49182 is a reply to message #49128] Tue, 02 January 2018 23:13 Go to previous message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Last problem with transparent colour fixed.

Best regards
Iñaki
Previous Topic: Dynamic example - 100% CPU core load
Next Topic: ScatterDraw overhaul. Please review
Goto Forum:
  


Current Time: Thu Mar 28 19:24:40 CET 2024

Total time taken to generate the page: 0.01375 seconds