# How to Draw Bar on the Map

**URL:** <https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170>\
**Category:** WinForms\
**Created:** [January 19, 2009, 1:56am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170 "2009-01-19T01:56:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mahender](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/m/96bed5/32.png) [@Mahender](https://community.thinkgeo.com/u/Mahender)\
**Post date:** [January 19, 2009, 1:56am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/1 "2009-01-19T01:56:16Z")

</div>

Hi&nbsp;,

using&nbsp;ZedGraph&nbsp;i&nbsp;drew&nbsp;the&nbsp;Pie&nbsp;Chart&nbsp;on&nbsp;the&nbsp;Map&nbsp;using&nbsp;Data&nbsp;from&nbsp;Sql&nbsp;server.

but&nbsp;i&nbsp;want&nbsp;to&nbsp;draw&nbsp;bar&nbsp;Chart&nbsp;,&nbsp;can&nbsp;any&nbsp;one&nbsp;help&nbsp;me&nbsp;on&nbsp;this&nbsp;issue.

Thanking&nbsp;you.

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [January 20, 2009, 2:07am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/2 "2009-01-20T02:07:23Z")

</div>

Mahender,

Here&nbsp;is&nbsp;a&nbsp;simple&nbsp;sample&nbsp;for&nbsp;you,&nbsp;if&nbsp;you&nbsp;want&nbsp;to&nbsp;make&nbsp;the&nbsp;bar&nbsp;more&nbsp;beautiful,&nbsp;please&nbsp;have&nbsp;a&nbsp;look&nbsp;at&nbsp;the&nbsp;documents&nbsp;of&nbsp;ZedGraph&nbsp;which&nbsp;is&nbsp;our&nbsp;internal&nbsp;engine&nbsp;for&nbsp;drawing&nbsp;bar/pie&nbsp;charts.  
&nbsp;[zedgraph.org/wiki/index.php?title=Main\_Page](http://zedgraph.org/wiki/index.php?title=Main_Page)  
&nbsp;  
The&nbsp;source&nbsp;code&nbsp;of&nbsp;ZedGraph&nbsp;is&nbsp;shipped&nbsp;with&nbsp;our&nbsp;product&nbsp;which&nbsp;you&nbsp;can&nbsp;get&nbsp;here:  
&nbsp;  
C:\Program&nbsp;Files\ThinkGeo\Map&nbsp;Suite&nbsp;Desktop&nbsp;Full&nbsp;Edition&nbsp;3.0&nbsp;(BETA)\Miscellaneous\Sources&nbsp;&&nbsp;License\ZedGraph&nbsp;Source&nbsp;&&nbsp;License  
&nbsp;  
SnapShot&nbsp;of&nbsp;the&nbsp;attached&nbsp;Simple&nbsp;Demo

 ![](https://community.thinkgeo.com/uploads/default/original/2X/1/1ff4ba93244e51c39806725d3e9aba13d849c741.JPG)

Please&nbsp;let&nbsp;us&nbsp;know&nbsp;for&nbsp;more&nbsp;queries.

Thanks,

Ben

[303-ShowBars.zip](https://community.thinkgeo.com/uploads/default/original/2X/1/14047d869e857ae4324971228b37c07ce8dfedc7.zip) (13.1 KB)

---

<div class="post-metadata">

**Author:** ![Rose](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rose](https://community.thinkgeo.com/u/Rose)\
**Post date:** [March 13, 2009, 10:03am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/3 "2009-03-13T10:03:34Z")

</div>

Good&nbsp;day,

I&nbsp;wanted&nbsp;to&nbsp;do&nbsp;a&nbsp;passage&nbsp;line&nbsp;statistics&nbsp;in&nbsp;the&nbsp;ocean&nbsp;to&nbsp;display&nbsp;the&nbsp;number&nbsp;of&nbsp;different&nbsp;type&nbsp;of&nbsp;ships&nbsp;passing&nbsp;a&nbsp;given&nbsp;line&nbsp;for&nbsp;a&nbsp;given&nbsp;timeframe.&nbsp;The&nbsp;X&nbsp;axis&nbsp;represents&nbsp;time&nbsp;and&nbsp;the&nbsp;Y&nbsp;axis&nbsp;represents&nbsp;number&nbsp;of&nbsp;vessels,&nbsp;but&nbsp;the&nbsp;X&nbsp;axis&nbsp;should&nbsp;be&nbsp;along&nbsp;the&nbsp;passage&nbsp;line&nbsp;I&nbsp;draw&nbsp;on&nbsp;the&nbsp;map,&nbsp;so&nbsp;the&nbsp;X&nbsp;axis&nbsp;can&nbsp;be&nbsp;any&nbsp;directions&nbsp;not&nbsp;always&nbsp;horizontal.&nbsp;Once&nbsp;the&nbsp;histogram&nbsp;is&nbsp;presented,&nbsp;the&nbsp;user&nbsp;can&nbsp;select&nbsp;any&nbsp;bar&nbsp;to&nbsp;see&nbsp;more&nbsp;details.

Is&nbsp;it&nbsp;possible&nbsp;to&nbsp;draw&nbsp;this&nbsp;kind&nbsp;of&nbsp;bar&nbsp;graph&nbsp;on&nbsp;the&nbsp;map?&nbsp;Any&nbsp;info&nbsp;is&nbsp;greatly&nbsp;appreciated.

Rose

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [March 15, 2009, 10:59pm UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/4 "2009-03-15T22:59:44Z")

</div>

Rose,&nbsp;  
&nbsp;&nbsp;  
&nbsp;The&nbsp;Y&nbsp;axis&nbsp;is&nbsp;always&nbsp;vertical&nbsp;to&nbsp;X&nbsp;axis&nbsp;no&nbsp;matter&nbsp;X&nbsp;is&nbsp;horizontal&nbsp;or&nbsp;not,&nbsp;right?&nbsp;I&nbsp;think&nbsp;you&nbsp;can&nbsp;get&nbsp;the&nbsp;horizontal&nbsp;graph&nbsp;first&nbsp;and&nbsp;then&nbsp;rotate&nbsp;it&nbsp;a&nbsp;proper&nbsp;degree&nbsp;to&nbsp;make&nbsp;the&nbsp;X&nbsp;axis&nbsp;along&nbsp;the&nbsp;passage&nbsp;line.&nbsp;Here&nbsp;is&nbsp;some&nbsp;code&nbsp;how&nbsp;to&nbsp;rotate&nbsp;a&nbsp;bitmap,&nbsp;&nbsp;the&nbsp;rotating&nbsp;degrees&nbsp;need&nbsp;to&nbsp;be&nbsp;calculated.&nbsp;  
&nbsp;&nbsp;  
&nbsp;`            // Get the bitmap from the Zed Graph            Bitmap bitmap = zedGraph.GraphPane.GetImage();            // Rotate the bitMap for 90 degrees            GdiPlusGeoCanvas gdiPlusGeoCanvas = new GdiPlusGeoCanvas();            Bitmap rotatedBitMap = new Bitmap(bitmap.Width, bitmap.Height);            gdiPlusGeoCanvas.BeginDrawing(rotatedBitMap,new RectangleShape(), GeographyUnit.Meter );            gdiPlusGeoCanvas.DrawScreenImageWithoutScaling(bitmap, bitmap.Width * 0.5f, bitmap.Height * 0.5f, DrawingLevel.LevelOne, 0, 0, 90);            gdiPlusGeoCanvas.EndDrawing();            // Set the rotated bitmap for each feature            e.Bitmap = rotatedBitMap;`&nbsp;  
&nbsp;As&nbsp;each&nbsp;bar&nbsp;chart&nbsp;is&nbsp;a&nbsp;picture&nbsp;on&nbsp;map,&nbsp;a&nbsp;specific&nbsp;bar&nbsp;cannot&nbsp;be&nbsp;selected.&nbsp;But&nbsp;by&nbsp;implementing&nbsp;the&nbsp;Map1.MapClick&nbsp;event,&nbsp;it’s&nbsp;easy&nbsp;to&nbsp;select&nbsp;the&nbsp;nearest&nbsp;feature&nbsp;and&nbsp;get&nbsp;the&nbsp;info&nbsp;of&nbsp;that&nbsp;point.&nbsp;So&nbsp;you&nbsp;can&nbsp;still&nbsp;click&nbsp;to&nbsp;select&nbsp;and&nbsp;show&nbsp;the&nbsp;detailed&nbsp;info.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Ben

---

<div class="post-metadata">

**Author:** ![Rose](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@Rose](https://community.thinkgeo.com/u/Rose)\
**Post date:** [March 16, 2009, 9:12am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/5 "2009-03-16T09:12:27Z")

</div>

Thanks&nbsp;Ben&nbsp;for&nbsp;your&nbsp;help.

You&nbsp;said:&nbsp;"By&nbsp;implementing&nbsp;the&nbsp;Map1.MapClick&nbsp;event,&nbsp;it's&nbsp;easy&nbsp;to&nbsp;select&nbsp;the&nbsp;nearest&nbsp;feature&nbsp;and&nbsp;get&nbsp;the&nbsp;info&nbsp;of&nbsp;that&nbsp;point.&nbsp;So&nbsp;you&nbsp;can&nbsp;still&nbsp;click&nbsp;to&nbsp;select&nbsp;and&nbsp;show&nbsp;the&nbsp;detailed&nbsp;info."

I&nbsp;am&nbsp;still&nbsp;not&nbsp;quite&nbsp;sure&nbsp;about&nbsp;this,the&nbsp;bar&nbsp;chart&nbsp;is&nbsp;a&nbsp;picture&nbsp;on&nbsp;the&nbsp;map,&nbsp;when&nbsp;I&nbsp;select&nbsp;the&nbsp;nearest&nbsp;feature&nbsp;where&nbsp;clicked,&nbsp;the&nbsp;whole&nbsp;picuture&nbsp;will&nbsp;be&nbsp;selected.&nbsp;&nbsp;How&nbsp;to&nbsp;get&nbsp;and&nbsp;highlight&nbsp;the&nbsp;exact&nbsp;bar&nbsp;that&nbsp;selected?

&nbsp;

Thanks

Rose

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Ben](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/ben/32/25720_2.png) [@Ben](https://community.thinkgeo.com/u/Ben)\
**Post date:** [March 16, 2009, 10:12pm UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/6 "2009-03-16T22:12:10Z")

</div>

Rose,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Sorry&nbsp;for&nbsp;the&nbsp;confusing.&nbsp;I&nbsp;mean&nbsp;you&nbsp;cannot&nbsp;select&nbsp;a&nbsp;specific&nbsp;bar&nbsp;in&nbsp;the&nbsp;chart,&nbsp;but&nbsp;you&nbsp;can&nbsp;select&nbsp;the&nbsp;point&nbsp;and&nbsp;get&nbsp;all&nbsp;the&nbsp;corresponding&nbsp;info&nbsp;of&nbsp;that&nbsp;point.&nbsp;That’s&nbsp;kind&nbsp;of&nbsp;a&nbsp;workaround&nbsp;but&nbsp;I’m&nbsp;not&nbsp;sure&nbsp;that&nbsp;meets&nbsp;your&nbsp;requirements.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Ben

---

<div class="post-metadata">

**Author:** ![rahim\_hajji](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/c57346/32.png) [@rahim\_hajji](https://community.thinkgeo.com/u/rahim_hajji)\
**Post date:** [April 8, 2010, 2:05am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/7 "2010-04-08T02:05:37Z")

</div>

Hello,&nbsp;  
&nbsp;&nbsp;  
&nbsp;i&nbsp;can’t&nbsp;download&nbsp;the&nbsp;sample.&nbsp;Is&nbsp;it&nbsp;possible&nbsp;to&nbsp;post&nbsp;the&nbsp;code?&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;the&nbsp;next&nbsp;question&nbsp;is,&nbsp;where&nbsp;can&nbsp;I&nbsp;download&nbsp;ZedGraphStyleExtension.dll?&nbsp;I&nbsp;can’t&nbsp;find&nbsp;it&nbsp;on&nbsp;[zedgraph.org](http://zedgraph.org).&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;help.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Rahim&nbsp;  
&nbsp;&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [April 8, 2010, 2:23am UTC](https://community.thinkgeo.com/t/how-to-draw-bar-on-the-map/170/8 "2010-04-08T02:23:43Z")

</div>

Rahim,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;interests&nbsp;in&nbsp;MapSuite&nbsp;component&nbsp;and&nbsp;welcome&nbsp;you&nbsp;to&nbsp;ThinkGeo&nbsp;MapSuite&nbsp;Destkop&nbsp;Discussion&nbsp;forum.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Why&nbsp;you&nbsp;cannot&nbsp;download&nbsp;the&nbsp;sample&nbsp;zipped?&nbsp;I&nbsp;tried&nbsp;again&nbsp;and&nbsp;it&nbsp;can&nbsp;be&nbsp;downloaded.&nbsp;The&nbsp;ZedGraphStyleExtension.dll&nbsp;is&nbsp;a&nbsp;wrapper&nbsp;DLL&nbsp;for&nbsp;ZedGraph,&nbsp;it&nbsp;is&nbsp;not&nbsp;an&nbsp;open&nbsp;source&nbsp;project.&nbsp;You&nbsp;can&nbsp;find&nbsp;it&nbsp;in&nbsp;our&nbsp;package&nbsp;after&nbsp;you&nbsp;install&nbsp;it.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks.&nbsp;  
&nbsp;&nbsp;  
&nbsp;Yale&nbsp;
