Select to view content in your preferred language

How to create graphics layer symbol as pie-chart???

7012
9
02-02-2012 07:17 AM
ArghaBera
Emerging Contributor
Hi All,

We have a urgent project requirement, to display the data as piechart on the map for each feature.We need to create a graphics layer symbol as piechart depending on the dynamic data. Any help or Suggestion would be highly appreciated .



Thanks in advance.
0 Kudos
9 Replies
DominiqueBroux
Esri Frequent Contributor
We need to create a graphics layer symbol as piechart

Please look at this sample which is demonstrating how to display pie chart in maptips and how to use pie chart as symbol.
0 Kudos
wangzhifang
Frequent Contributor
Generally speaking, you have three choice to achieve your target:
1. InfoWindow/MapTip. Put your any chart controls in InfoWindow/MapTip, it reasonable and good practice, but you need to click or put mouse over this graphic to show the chart.
2. Extend the MarkerSymbol class. This means set the chart as a symbol itself of a graphic.
3. Using the ElementLayer, treat each chart control as an UIElement and pin each one on a fixed map point.
0 Kudos
ArghaBera
Emerging Contributor
Thanks diligentpig.

2nd and 3rd option which you have mentioned seems to be usefull in my case.Can you please share some code base if you have anything handy or provide some Suggestion on how to do that.

Thanks
0 Kudos
wangzhifang
Frequent Contributor
Thanks diligentpig.

2nd and 3rd option which you have mentioned seems to be usefull in my case.Can you please share some code base if you have anything handy or provide some Suggestion on how to do that.

Thanks

Sorry, there is no ready to use code for this two methods now. But you can read following related links, hope this will be helpful.
For method 2, please reference to online symbol gallery to look at how to custom a map symbol.
http://help.arcgis.com/en/webapi/silverlight/samples/SymbolGalleryWeb/start.htm
For method 3, here is a sample to demonstrate how to add UIElement to ElementLayer in xaml, you can also do this in code. And just consider your chart control as an UIElement.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ElementLayer

Here is a Chinese blog showing the final image of the two methods. http://blog.newnaw.com/?p=480
debangshubhattacharyya
Deactivated User

Thank you, The Chinese blog bring the purpose.

0 Kudos
PawanVuppala
Frequent Contributor
Hello,
I have downloaded and got the sample working for states layer.  Trying to do something similar State County layer.  I have created a map service which has County polygons and some summarized values which I need to do a pie chart for.  I can't figure out what I'm missing.  Here's what I have for my Map tag
<esri:Map x:Name="mapView" Extent="-96,33,-86,30">
            <esri:Map.Layers>
                <esri:ArcGISTiledMapServiceLayer ID="StreetMapLayer"
                      Url="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" />
                <esri:FeatureLayer ID="StatesPolygonFeatureLayer"
                      Url="http://myserver/ArcGIS/rest/services/Maps/CM/MapServer" 
                      FeatureSymbol="{StaticResource LightFillSymbol}"
                      UpdateCompleted="FeatureLayer_UpdateCompleted">
                    <esri:FeatureLayer.OutFields>
                        <system:String>COUNTY</system:String>
                        <system:String>BLACK</system:String>
                        <system:String>WHITE</system:String>
                        </esri:FeatureLayer.OutFields>
                    <esri:FeatureLayer.MapTip>
                        <Grid>
                            <Grid.Background>
                                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                    <GradientStop Color="#AA333333"/>
                                    <GradientStop Color="#AAEEEEEE" Offset="1"/>
                                </LinearGradientBrush>
                            </Grid.Background>
                            <pieChartSymbology:PieChartMapTip Name="pieChart" 
                                                              ChartTitle="{Binding [COUNTY], Mode=OneWay}" 
                                                              LegendTitle="Legend">
                                <pieChartSymbology:PieChartMapTip.PieElements>
                                    <pieChartSymbology:PieElement FieldName="BLACK" DisplayName="BLACK" />
                                    <pieChartSymbology:PieElement FieldName="WHITE" DisplayName="WHITE" />
                                </pieChartSymbology:PieChartMapTip.PieElements>
                            </pieChartSymbology:PieChartMapTip>
                        </Grid>
                    </esri:FeatureLayer.MapTip>
                </esri:FeatureLayer>

                <esri:GraphicsLayer ID="StatesCentroidGraphicsLayer"/>

            </esri:Map.Layers>
        </esri:Map>

I also created a Geometry service and have referenced it in .cs file for graphics layer. So far I dont see anything other than just base map (Streetmaplayer) 😞

Please help!!!

Sorry, there is no ready to use code for this two methods now. But you can read following related links, hope this will be helpful.
For method 2, please reference to online symbol gallery to look at how to custom a map symbol.
http://help.arcgis.com/en/webapi/silverlight/samples/SymbolGalleryWeb/start.htm
For method 3, here is a sample to demonstrate how to add UIElement to ElementLayer in xaml, you can also do this in code. And just consider your chart control as an UIElement.
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ElementLayer

Here is a Chinese blog showing the final image of the two methods. http://blog.newnaw.com/?p=480
0 Kudos
DominiqueBroux
Esri Frequent Contributor
<esri:FeatureLayer ID="StatesPolygonFeatureLayer"
Url="http://myserver/ArcGIS/rest/services/Maps/CM/MapServer"

Your URL is not correct for a feature layer. You have to add the layerID.
For example
Url="http://myserver/ArcGIS/rest/services/Maps/CM/MapServer/3"
0 Kudos
EricCreahi
Emerging Contributor
Difficult to install
http://www.arcgis.com/home/item.html?id=b135d66549364786b381e85451742d56
ESRI.ArGIS.Client.dll  , i use the last version.
0 Kudos
EricCreahi
Emerging Contributor
Another question.
Please where can I find the pieChartSymbology ?
I use this one xmlns:pieChartSymbology="clr-namespace:ESRI.ArcGIS.Client.Symbols;assembly=ESRI.ArcGIS.Client"
But nothing change.
0 Kudos