Recently, I have studied the implementation of the ArcGIS Server Web ADF (9.2) Thematic Map as follows (taking the bar chart as an example, the pie chart is similar to the histogram). I hope it will help you! // Obtain the layer ID of the topic.
..........
Int layerid = 3;
// Obtain the attribute name list of the topic graph analysis element.
String [] fieldname = new string [2];
Fieldname [0] = "pop1990 ";
Fieldname [1] = "pop1999 ";
// Obtain the layer object (featurelayer) of the topic graph analysis)
Agslocalmapresource res = (agslocalmapresource) This. webcontext
. Getresources (). Get ("ags0 ");
Mapserver = res. getlocalmapserver ();
Ilayer filayer = mapserver. getlayer (mapserver. getmapname (0), layerid );
Featurelayer flayer = (featurelayer) filayer;
// Create a chartrenderer object. Note: Use the createarcobject (string) method of the agslocalmapresource object to create an AO object in the Web ADF.
Chartrenderer chartrender = (chartrenderer) res
. Createarcobject (chartrenderer. getclsid ());
// Specify the Field Values in each column of the bar chart in irendererfileds.
Irendererfields rendererfields = chartrender;
Rendererfields. addfield (fieldname [0], null );
Rendererfields. setfieldalias (0, rendererfields. getfield (0 ));
Rendererfields. addfieldfieldname [1], null );
Rendererfields. setfieldalias (1, rendererfields. getfield (1 ));
// Find the maximum value required for each element's specified attribute
Queryfilter = (queryfilter) res
. Createarcobject (queryfilter. getclsid ());
Queryfilter. addfield (fieldname [0]);
Queryfilter. addfield (fieldname [1]);
Icursor cursor = flayer. itable_search (queryfilter, true );
Int numfields = 2; // Number of bar chart Columns
Int [] fieldindecies = new int [numfields];
Fieldindecies [0] = flayer. findfield (fieldname [0]);
Fieldindecies [1] = flayer. findfield (fieldname [1]);
Double maxvalue = 0;
Boolean firstvalue = true;
Irowbuffer ROW = cursor. nextrow ();
While (row! = NULL ){
String fieldvalue = "";
For (INT fieldindex = 0; fieldindex <numfields; fieldindex ++ ){
Double fieldvalue = double. parsedouble (row. getvalue (
Fieldindecies [fieldindex]). tostring ());
If (firstvalue ){
Maxvalue = fieldvalue;
Firstvalue = false;
}
If (fieldvalue> maxvalue)
Maxvalue = fieldvalue;
}
Row = cursor. nextrow ();
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.