ANYONE Know How To CREATE PIE Symbols?

727
5
10-29-2012 12:10 PM
troyturcott
New Contributor II
I've read just a little regarding symbology based on dojox.gfx API and esri.namespace methods. Has anyone attempted creating a pie symbol?
0 Kudos
5 Replies
BrandonHerrington
New Contributor II
We used the dojox/charting portion of the API and it worked pretty well. http://dojotoolkit.org/reference-guide/1.7/dojox/charting.html#dojox-charting
0 Kudos
troyturcott
New Contributor II
Thanks for the reply Brandon...did you actually render point features using the dojox.charting API?
If so, how would you go about initializing the PIE symbol if you did a simple point feature query like:

================================================================================
var map,simpleMarkerSymbol,pieSymbol, resultTemplate;

function init() { blah, blah, blah....

//initialize symbology for SimpleMarkerSymbol PIE SYMBOL
simpleMarkerSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([0,0,255]));

//initialize symbology for PIE SYMBOL
pieSymbol = new ???? .Symbol().setSomething(XXXX);


//initialize & execute query
var queryTask = new esri.tasks.QueryTask("http://service_with_point_data/MapServer/0");
var query = new esri.tasks.Query();
query.where = "1 = 1";
query.outSpatialReference = {wkid:102100};
query.returnGeometry = true;
query.outFields = ["*"];
queryTask.execute(query, addPointsToMap);

//info template for points returned
resultTemplate = new esri.InfoTemplate("Point Data", "<tr><td>${POINT_ID}</tr></td>");
}


//add points to map and set their symbology + info template
function addPointsToMap(featureSet) {
dojo.forEach(featureSet.features,function(feature){
map.graphics.add(feature.setSymbol(pieSymbol ).setInfoTemplate(resultTemplate));
});}
0 Kudos
BrandonHerrington
New Contributor II
Sorry. Reread your question and I had missed that you were specifically doing symbology on the map. We only used it either outside of the map or in a popup/callout on the map.
0 Kudos
JeffPace
MVP Alum
havent done symbology, but have done in popups using googles chart api

var att = f.attributes;

            var TOTAL2K = parseInt(att.TOTAL2K);
            var WHITE2K = parseInt(att.WHITE2K);
            var HISPAN2K = parseInt(att.HISPAN2K);
            var BLACK2K = parseInt(att.BLACK2K);
            var AM_IND2K = parseInt(att.AM_IND2K);
            var ASIAN2K = parseInt(att.ASIAN2K);
            var PAC_ISLAND2K = parseInt(att.PAC_ISLAND2K);
            var OTHER2K = parseInt(att.OTHER2K);

            WHITE2K = (WHITE2K / TOTAL2K) * 100;
            BLACK2K = (BLACK2K / TOTAL2K) * 100;
            HISPAN2K = (HISPAN2K / TOTAL2K) * 100;
            AM_IND2K = (AM_IND2K / TOTAL2K) * 100;
            ASIAN2K = (ASIAN2K / TOTAL2K) * 100;
            PAC_ISLAND2K = (PAC_ISLAND2K / TOTAL2K) * 100;
            OTHER2K = (OTHER2K / TOTAL2K) * 100;


            var chart = {
                content:"<div style='width:260px; height:155px;'><b>Total 2000 Census Block Population is " + TOTAL2K + ".</b><br />The ethnicity breakdown is as follows. <br />"
                    + "<img  src='http://chart.apis.google.com/chart?chco=92BF23,cc0000&chf=c,s,EFEFEF00&cht=p3&chs=260x130&chd=t:"
                    + WHITE2K + "," + BLACK2K + "," +HISPAN2K+","+ AM_IND2K + "," + ASIAN2K + ","
                    + PAC_ISLAND2K + "," + OTHER2K  + "&chdl=White ("
                    + Math.round(WHITE2K)+"%)|Black ("
                    + Math.round(BLACK2K)+"%)|Hispanic ("
                    + Math.round(HISPAN2K)+"%)|Am Ind ("
                 + Math.round(AM_IND2K)+"%)|Asian ("
                    + Math.round(ASIAN2K)+"%)|Pac Isl ("
                    + Math.round(PAC_ISLAND2K)+"%)|Other ("
                    + Math.round(OTHER2K)+"%)' /></div>"
            };

           return chart.content;
0 Kudos
SteveCole
Frequent Contributor
Maybe your service can use the symbology that Jim Mossman created years ago and is discussed in this old ArcUser magazine article?
0 Kudos