I decided it was time to learn to use GDIPLUS by writing a useful demonstration application.
This demo application (xyChartDemo) uses GDIPLUS to draw an XY graph with multiple data series and dynamically modifiable display properties in a resizeable window. Once I worked through translating MSDN C# code and hints to VIP, and evolved a workable code model, it became relatively smooth going.
The working code is in the Chart_PACK package and should be able to be added to a new or existing package without complication. I plan to add more capability beyond simple XY graphing.
I expect I'll get suggestions for improvement on this from the VIP community -- they are welcome!
Feel free to use and modify Chart_PACK as you wish.
You can download the full ZIPped project here: https://drive.google.com/open?id=0B9B9r ... zU2bkdveHM
PDF Documentation: https://drive.google.com/open?id=0B9B9r ... HFzU01NNTQ
-
- VIP Member
- Posts: 453
- Joined: 5 Nov 2000 0:01
xyChartDemo - GDIPLUS XY graphing demonstration
- Attachments
-
- Screen image of plot and property editor.
- xyChart Plot and Properties compressed 50pct.jpg (118.26 KiB) Viewed 39979 times
-
- Chart_PACK.zip
- Chart_PACK.zip only
- (42.84 KiB) Downloaded 1225 times
-
- VIP Member
- Posts: 106
- Joined: 6 Mar 2000 0:01
-
- VIP Member
- Posts: 453
- Joined: 5 Nov 2000 0:01
Re: xyChartDemo - GDIPLUS XY graphing demonstration
UPGRADE FOR Vip8:
The original version of xyChartDemo was developed with Vip7 and is not plug-and-play compatible with Vip8 due to some minor changes in the version 8 PFC Graphics class. I have made the necessary changes (mostly in Chart.pro), added a few trivial features (e.g., save and recall named graph display properties) and improved the documentation. The Chart_PACK package can be used directly in your applications.
The download link to the new Zip file for xyChartDemo_Vip8 is here: https://drive.google.com/open?id=1tFBFH ... 6MOjJlkHO6
Right-click the link and Save As ... to download the project Zip file.
The original version of xyChartDemo was developed with Vip7 and is not plug-and-play compatible with Vip8 due to some minor changes in the version 8 PFC Graphics class. I have made the necessary changes (mostly in Chart.pro), added a few trivial features (e.g., save and recall named graph display properties) and improved the documentation. The Chart_PACK package can be used directly in your applications.
The download link to the new Zip file for xyChartDemo_Vip8 is here: https://drive.google.com/open?id=1tFBFH ... 6MOjJlkHO6
Right-click the link and Save As ... to download the project Zip file.
Re: xyChartDemo - GDIPLUS XY graphing demonstration
This is great! I have the demo working on V9. However, I needed to change the following:
Because in chartDecoration.pro at line #243 crashes if you do not have the named font installed at the following call.
The exception is thrown in "fontfamily.pro" #20.
In the "gdiplus_native::gdipCreateFontFamilyFromName" call. I'm not sure why I don't have "Lucida Sans" on my system, but it is a clean Windows 8 virtual machine.
Anyways, It works when I make sure the font is valid.
Thanks again, and Cheers!
Code: Select all
%fNameLABEL = "Lucida Sans". % used for axis labels
%fNameVALUE = "Lucida Sans". % used for axis values at tics & grids
fNameLABEL = "Arial". % used for axis labels
fNameVALUE = "Arial". % used for axis values at tics & grids
Code: Select all
fontValues() = FONT :-
FF = fontFamily::createFromName(fNameVALUE), % THIS CALL CRASHES IF THE FONT IS NOT INSTALLED
FS = 0,
FONT = font::createFromFontFamily(FF, 8, FS, unitPixel).
Code: Select all
clauses
createFromName(Name, Collection) :-
checkStatus(gdiplus_native::gdipCreateFontFamilyFromName(Name, Collection:nativeFontCollection, NativeFontFamily)),
newNative(NativeFontFamily).
Anyways, It works when I make sure the font is valid.
Thanks again, and Cheers!
-
- VIP Member
- Posts: 453
- Joined: 5 Nov 2000 0:01
Re: xyChartDemo - GDIPLUS XY graphing demonstration
Hi Choibakk!
I'm glad you found the demo helpful.
Lucida Sans is installed with Win10 -- I didn't think of setting up the demo for older versions of windows. I'm glad you could fix the problem.
My code could be cleaned up and some day I may get around to that ... feel free to 'tune it up' and re-post it if you want. It won't hurt my feelings.
Harrison
I'm glad you found the demo helpful.
Lucida Sans is installed with Win10 -- I didn't think of setting up the demo for older versions of windows. I'm glad you could fix the problem.
My code could be cleaned up and some day I may get around to that ... feel free to 'tune it up' and re-post it if you want. It won't hurt my feelings.
Harrison
-
- VIP Member
- Posts: 453
- Joined: 5 Nov 2000 0:01
Re: xyChartDemo - GDIPLUS XY graphing demonstration
Attached is a trivial upgrade of xyChartDemo for Vip10x.
There are no changes other than tidying it up for 10x.
There are no changes other than tidying it up for 10x.
- Attachments
-
- xyChartDemo.zip
- (242.44 KiB) Downloaded 530 times