MapWindow Developer Team : MapWindow Discussion Forum
Attachments: piecharts3D.png (14.7 KB) barchart.png (5.9 KB)
Attachments: barcharts3D.png (6.7 KB)
Attachments: chartsize.png (48.2 KB)
Hi, The charts will be available in MapWinGis soon. Some info about implemntation can be found here: [www.mapwindow.org]. I attach some screenshots. Write your comments
Charts in MapWinGis
Posted by:
Sergei ()
Date: June 21, 2010 02:31PM
Hi,
The charts will be available in MapWinGis soon. Some info about implemntation can be found here: [www.mapwindow.org]. I attach some screenshots. Write your comments and suggestions.
Thanks,
Sergei
Edited 2 time(s). Last edit at 06/21/2010 02:36PM by Sergei.
The charts will be available in MapWinGis soon. Some info about implemntation can be found here: [www.mapwindow.org]. I attach some screenshots. Write your comments and suggestions.
Thanks,
Sergei
Edited 2 time(s). Last edit at 06/21/2010 02:36PM by Sergei.
Attachments: piecharts3D.png (14.7 KB) barchart.png (5.9 KB)
Re: Charts in MapWinGis
Posted by:
pmeems ()
Date: June 22, 2010 02:57AM
Sergei,
Thanks for all the progress you've made.
The screenshots look great.
We've been mailing about the naming of your methods:
You've named them all with 'Bar' in them, but in the description you refer to bars and sectors.
Wouldn't it be more clear to rename the 'Bar' methods to 'Chart' when they are for bars and sectors?
So AddBar becomes AddChart, InsertBar --> InsertChart, BarField --> ChartField, etc.?
Perhaps others might have suggestions as well?
--
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
Thanks for all the progress you've made.
The screenshots look great.
We've been mailing about the naming of your methods:
You've named them all with 'Bar' in them, but in the description you refer to bars and sectors.
Wouldn't it be more clear to rename the 'Bar' methods to 'Chart' when they are for bars and sectors?
So AddBar becomes AddChart, InsertBar --> InsertChart, BarField --> ChartField, etc.?
Perhaps others might have suggestions as well?
--
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 22, 2010 03:11AM
Paul,
just to have more options... How about renaming 'bar' to 'field'. The methods/properties will look like as following:
What do you think? Are there other suggestions?
Sergei
just to have more options... How about renaming 'bar' to 'field'. The methods/properties will look like as following:
Charts.AddField(int FieldIndex, OLE_COLOR Color); Charts.ClearFields(); Charts.get_FieldIndex(int Index); // fieldIndex is index in the attribute table; Charts.get_FieldColor(int Index); // Index is index of field in the list of fields for the given chart
What do you think? Are there other suggestions?
Sergei
Re: Charts in MapWinGis
Posted by:
bmarch ()
Date: June 22, 2010 02:59PM
They look great Sergei. Are you rendering the images yourself or are you using a package from somewhere?
I'm just gonna throw this out there, but would it be possible to add the same adornments that you can for labels, like rotation, drop shadow, halo etc. Just wondering really.
I'm just gonna throw this out there, but would it be possible to add the same adornments that you can for labels, like rotation, drop shadow, halo etc. Just wondering really.
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 22, 2010 03:42PM
Brian,
I draw it myself using GDI+. There was option to use OpenGL for 3D mode, but I decided to spare time and not to add additional dependancy. As for 'adorments' - I plan to add standard options for fill (hatch brush, gradient brush). Shadow/halo - I need to see some example easy enough to implement in GDI+. Actually I don't see dire necessity in such things as plain 2D chart are good enough for analysis, but in case it's easy - why not? Rotation is available for piecharts. Do we need it for bar charts as well? Also I plan to add piecharts of variable radius according to some field in attribute table.
The screenshot of bar charts in 3D is attached.
Regards,
Sergei
Edited 1 time(s). Last edit at 06/22/2010 05:02PM by Sergei.
I draw it myself using GDI+. There was option to use OpenGL for 3D mode, but I decided to spare time and not to add additional dependancy. As for 'adorments' - I plan to add standard options for fill (hatch brush, gradient brush). Shadow/halo - I need to see some example easy enough to implement in GDI+. Actually I don't see dire necessity in such things as plain 2D chart are good enough for analysis, but in case it's easy - why not? Rotation is available for piecharts. Do we need it for bar charts as well? Also I plan to add piecharts of variable radius according to some field in attribute table.
The screenshot of bar charts in 3D is attached.
Regards,
Sergei
Edited 1 time(s). Last edit at 06/22/2010 05:02PM by Sergei.
Attachments: barcharts3D.png (6.7 KB)
Re: Charts in MapWinGis
Posted by:
pmeems ()
Date: June 23, 2010 05:09AM
Sergei,
Renaming 'bar' to 'field' is fine by me.
I agree plain 2D charts are good enough, but it would be nicer to make them look fancier ;)
I can't think of any use of rotated bar charts, so if nobody else needs it leave it for now.
Thanks,
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
Renaming 'bar' to 'field' is fine by me.
I agree plain 2D charts are good enough, but it would be nicer to make them look fancier ;)
I can't think of any use of rotated bar charts, so if nobody else needs it leave it for now.
Thanks,
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
Re: Charts in MapWinGis
Posted by:
bmarch ()
Date: June 23, 2010 09:10AM
Paul,
"I can't think of any use for ... " Those are very powerful words, just because you can't think of a use for it doesn't mean nobody else will, and that happens a lot with code = )
An example I want my bar graphs going left to right instead of top to bottom, rotation could do that and I really doubt it would affect drawing performance.
Sergei if possible why don't you make it so all the methods for bar graphs are the same as the methods for pie charts.
Also it would be really cool if each section of the pie or bar of a graph could have a gradient fill. If you're using GDI+ then you could simply leave the fill as a standard brush. Edit (Ok I see you mentioned gradient brushes above)
Brian
Edited 1 time(s). Last edit at 06/23/2010 09:11AM by bmarch.
"I can't think of any use for ... " Those are very powerful words, just because you can't think of a use for it doesn't mean nobody else will, and that happens a lot with code = )
An example I want my bar graphs going left to right instead of top to bottom, rotation could do that and I really doubt it would affect drawing performance.
Sergei if possible why don't you make it so all the methods for bar graphs are the same as the methods for pie charts.
Also it would be really cool if each section of the pie or bar of a graph could have a gradient fill. If you're using GDI+ then you could simply leave the fill as a standard brush. Edit (Ok I see you mentioned gradient brushes above)
Brian
Edited 1 time(s). Last edit at 06/23/2010 09:11AM by bmarch.
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 24, 2010 04:11AM
2Brian: I'll try to make uniform properties for bar and pie where it is possible. I plan to add different fill types before the end of this week. Thanks for comments.
One more general question:
It's necessary to prevent overlapping charts in the same way it's done for labels. There is no problems with implemntation. The question is: whether they need to share a common collision list with labels or use separate list, i.e. do I need to prevent labels vs charts collisions. As an option I can make switches for it:
In case the common collision list is used labels vs charts, labels vs points, charts vs points collisions will be prevented. When properties are set to false separate collision lists will be used in each case.
What do you think of such approach?
Thanks,
Sergei
One more general question:
It's necessary to prevent overlapping charts in the same way it's done for labels. There is no problems with implemntation. The question is: whether they need to share a common collision list with labels or use separate list, i.e. do I need to prevent labels vs charts collisions. As an option I can make switches for it:
bool Map.UseCommonCollisionListForLabels; bool Map.UseCommonCollisionListForCharts; bool Map.UseCommonCollisionListForPoints;
In case the common collision list is used labels vs charts, labels vs points, charts vs points collisions will be prevented. When properties are set to false separate collision lists will be used in each case.
What do you think of such approach?
Thanks,
Sergei
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 24, 2010 03:27PM
Here is screeshot of pie charts with radius set by area of county. Collision avoidance is implemented as well. The test code in C# is below. Write your comments/suggestions.
Thanks,
Sergei
Thanks,
Sergei
private void btnCharts_Click(object sender, EventArgs e) { MapWinGIS.Shapefile sf = new MapWinGIS.Shapefile(); openFileDialog1.Filter = "Shapefile|*.shp"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { sf.Open(openFileDialog1.FileName, null); sf.DefaultDrawingOptions.FillColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.LightGreen)); axMap1.AddLayer(sf, true); MapWinGIS.Charts charts = sf.Charts; charts.Visible = true; charts.Use3DMode = true; charts.LineColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.Green)); charts.Transparency = 255; charts.AddField(18, Convert.ToUInt32(ColorTranslator.ToOle(Color.Blue))); // the first parameter is field index charts.AddField(19, Convert.ToUInt32(ColorTranslator.ToOle(Color.Green))); charts.AddField(20, Convert.ToUInt32(ColorTranslator.ToOle(Color.Yellow))); charts.AddField(21, Convert.ToUInt32(ColorTranslator.ToOle(Color.Brown))); charts.AddField(22, Convert.ToUInt32(ColorTranslator.ToOle(Color.Orange))); charts.UseVariableRadius = true; charts.ChartType = tkChartType.chtPieChart; charts.PieRotation = 0.0; charts.PieRadius = 10; charts.PieRadius2 = 50; charts.BarHeight = 100; charts.BarWidth = 8; charts.Thickness = 10; charts.Tilt = 30.0; charts.NormalizationField = 6; charts.SizeField = 5; charts.VerticalPosition = tkVerticalPosition.vpAboveParentLayer; charts.ColorScheme.SetColorRange2(tkMapColor.Azure, tkMapColor.Pink); charts.RefreshColors(); charts.SetPositions(tkLabelPositioning.lpCenter); axMap1.Redraw(); } }
Attachments: chartsize.png (48.2 KB)
Re: Charts in MapWinGis
Posted by:
geofran80 ()
Date: June 25, 2010 12:40AM
Dear Sergei,
How can I use the Charts if I cannot find into MapWinGIS namespace?
Thanks and great works.
Francisco J.
How can I use the Charts if I cannot find into MapWinGIS namespace?
Thanks and great works.
Francisco J.
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 25, 2010 02:57AM
Francisco,
I haven't commited the code yet. I put this sample code to hear suggestions about API. The code will be available in a week (I still need to merge my version with code for rotation by Andrew Purkis).
Regards,
Sergei
I haven't commited the code yet. I put this sample code to hear suggestions about API. The code will be available in a week (I still need to merge my version with code for rotation by Andrew Purkis).
Regards,
Sergei
Re: Charts in MapWinGis
Posted by:
geofran80 ()
Date: June 25, 2010 03:13AM
The code and results are very interesting.
I only have a suggestion:
1. With the AddField into the charts. Could be interesting use the following items?
Chart.Series as a Collection of Series of data.
Chart.Serie as a Collection of items.
Chart.Serie.Item as a item with any custom data.
Hope it serves you and another users.
Many thanks for your work.
Francisco J.
Edited 2 time(s). Last edit at 06/25/2010 03:13AM by geofran80.
I only have a suggestion:
1. With the AddField into the charts. Could be interesting use the following items?
Chart.Series as a Collection of Series of data.
Chart.Serie as a Collection of items.
Chart.Serie.Item as a item with any custom data.
Hope it serves you and another users.
Many thanks for your work.
Francisco J.
Edited 2 time(s). Last edit at 06/25/2010 03:13AM by geofran80.
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 25, 2010 05:48AM
Well, I have no objections here. In some cases I have to write less object-oriented API to unsure performance (COM objects are slow; more objects - less speed). But in this case speed isn't critical at all. So to be sure, the question to everybody: do you agree with Francisco's suggestion?
The other option is to implement only class for individual fields and not to implement collection.
To insert field we'll use:
Now only this line is necessary:
What do you think?
Thanks,
Sergei
The other option is to implement only class for individual fields and not to implement collection.
IChartField* Charts.get_Field(FieldIndex);
class ChartField
{
int FieldIndex;
OLE_COLOR Color;
BSTR Name;
}
To insert field we'll use:
MapWinGIS.ChartField fld = new MapWinGIS.ChartField(); fld.Color = Red; fld.Index = 5; sf.Charts.AddField(fld);
Now only this line is necessary:
sf.Charts.AddField(5, Red);
What do you think?
Thanks,
Sergei
Re: Charts in MapWinGis
Posted by:
geofran80 ()
Date: June 25, 2010 06:08AM
Sergei, don't worry, i confused the field as a data point not as field, and then I was thinking that the last developer could take as equal the Chart.Field and the Shapefile.Field.
I think that your suggestion is correct.
Thanks.
Francisco J.
I think that your suggestion is correct.
Thanks.
Francisco J.
Re: Charts in MapWinGis
Posted by:
Sergei ()
Date: June 25, 2010 12:14PM
Following object-oriented suggestions: properties of individual charts can be accessed from Charts class now:
Perhaps it's not very intuitive and it's better to make additional class here too:
Usage:
What do you think?
Thanks,
Sergei
Edited 1 time(s). Last edit at 06/25/2010 03:27PM by Sergei.
MapWinGIS.Charts charts = sf.Charts;
if (charts.ChartVisible(ChartIndex))
{
charts.PositionX(ChartIndex) += 10;
charts.PositionY(ChartIndex) += 10;
}
Perhaps it's not very intuitive and it's better to make additional class here too:
class CChart
{
int PositionX;
int PositionY;
bool Visible;
bool IsDrawn;
IExtents* extents; // in screen coordinates
};
Usage:
MapWinGIS.Chart chart = sf.Charts.Item(ChartIndex);
if (chart.IsDrawn)
{
chart.PositionX += 10;
chart.PositionY += 10;
}
What do you think?
Thanks,
Sergei
Edited 1 time(s). Last edit at 06/25/2010 03:27PM by Sergei.
Re: Charts in MapWinGis
Posted by:
pmeems ()
Date: June 25, 2010 03:04PM
Sergei,
It looks all great.
I can't really comment about your code suggestions. I completely rely on you. Choose what you think is best.
Thanks,
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
It looks all great.
I can't really comment about your code suggestions. I completely rely on you. Choose what you think is best.
Thanks,
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
Re: Charts in MapWinGis
Posted by:
lloyd ()
Date: July 13, 2010 03:18AM
It's a good news
Does this feature support in MapWin ActiveX ?
and can it be downloaded now ?
Thanks
Does this feature support in MapWin ActiveX ?
and can it be downloaded now ?
Thanks
Re: Charts in MapWinGis
Posted by:
pmeems ()
Date: July 13, 2010 12:51PM
Yes, you can get the latest binaries from MapWindow4Dev/Bin or get them all using WeeklyBuilds/LatestPatch.zip
--
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
--
Paul
--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group
Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.
---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS
Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl
*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn
Re: Charts in MapWinGis
Posted by:
lloyd ()
Date: July 16, 2010 01:26AM
I used the lastest patch ocx & dlls , but VS always throw the exception when running:
The exception unkown software exception(0xc0000417) occurred in the application at location 0x7858c955.
The below are codes which copy from Sergei's post:
--------------------------------------------------------------------
charts.Visible = true;
charts.Use3DMode = true;
charts.LineColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.Green));
charts.Transparency = 255;
charts.AddField(18, Convert.ToUInt32(ColorTranslator.ToOle(Color.Blue))); // the first parameter is field index
charts.AddField(19, Convert.ToUInt32(ColorTranslator.ToOle(Color.Green)));
charts.AddField(20, Convert.ToUInt32(ColorTranslator.ToOle(Color.Yellow)));
charts.AddField(21, Convert.ToUInt32(ColorTranslator.ToOle(Color.Brown)));
charts.AddField(22, Convert.ToUInt32(ColorTranslator.ToOle(Color.Orange)));
charts.UseVariableRadius = true;
charts.ChartType = tkChartType.chtPieChart;
charts.PieRotation = 0.0;
charts.PieRadius = 10;
charts.PieRadius2 = 50;
charts.BarHeight = 100;
charts.BarWidth = 8;
charts.Thickness = 10;
charts.Tilt = 30.0;
charts.NormalizationField = 6;
charts.SizeField = 5;
charts.VerticalPosition = tkVerticalPosition.vpAboveParentLayer;
charts.ColorScheme.SetColorRange2(tkMapColor.Azure, tkMapColor.Pink);
charts.RefreshColors();
charts.SetPositions(tkLabelPositioning.lpCenter);
axMap1.Redraw();
The exception unkown software exception(0xc0000417) occurred in the application at location 0x7858c955.
The below are codes which copy from Sergei's post:
--------------------------------------------------------------------
charts.Visible = true;
charts.Use3DMode = true;
charts.LineColor = Convert.ToUInt32(ColorTranslator.ToOle(Color.Green));
charts.Transparency = 255;
charts.AddField(18, Convert.ToUInt32(ColorTranslator.ToOle(Color.Blue))); // the first parameter is field index
charts.AddField(19, Convert.ToUInt32(ColorTranslator.ToOle(Color.Green)));
charts.AddField(20, Convert.ToUInt32(ColorTranslator.ToOle(Color.Yellow)));
charts.AddField(21, Convert.ToUInt32(ColorTranslator.ToOle(Color.Brown)));
charts.AddField(22, Convert.ToUInt32(ColorTranslator.ToOle(Color.Orange)));
charts.UseVariableRadius = true;
charts.ChartType = tkChartType.chtPieChart;
charts.PieRotation = 0.0;
charts.PieRadius = 10;
charts.PieRadius2 = 50;
charts.BarHeight = 100;
charts.BarWidth = 8;
charts.Thickness = 10;
charts.Tilt = 30.0;
charts.NormalizationField = 6;
charts.SizeField = 5;
charts.VerticalPosition = tkVerticalPosition.vpAboveParentLayer;
charts.ColorScheme.SetColorRange2(tkMapColor.Azure, tkMapColor.Pink);
charts.RefreshColors();
charts.SetPositions(tkLabelPositioning.lpCenter);
axMap1.Redraw();
Re: Charts in MapWinGis
Posted by:
lloyd ()
Date: July 16, 2010 02:07AM
if can provide some examples about chart feature , will very very appreciate.
Sorry, only registered users may post in this forum.


