Select to view content in your preferred language

Classification field

1121
5
Jump to solution
12-27-2012 10:47 AM
SamirGambhir
Frequent Contributor
Hi,
My GenerateRendererTask generates a renderer and lists the class break in a legend div. The numbers in the class breaks are unformatted. Is there a way to programmatically format these numbers e.g. instead of 8.808848 - 17.767013, I should see 8.81 - 17.77?
I am using Arcgis Server 10.1 with Javascript API.
Thanks
Samir
0 Kudos
1 Solution

Accepted Solutions
JeffPace
MVP Alum
my guess is just prior to
stateFeatureLayer.setRenderer(renderer);

you will have to evaluate and modify the renderer

from classbreaksrenderer API
var symbols = dojo.map(results[0].layer.renderer.infos,function(info){
  return  {label: info.label,symbol:info.symbol};
});

seems to indicate that you could override the label with a rounded value

View solution in original post

0 Kudos
5 Replies
JeffPace
MVP Alum
Hi,
My GenerateRendererTask generates a renderer and lists the class break in a legend div. The numbers in the class breaks are unformatted. Is there a way to programmatically format these numbers e.g. instead of 8.808848 - 17.767013, I should see 8.81 - 17.77?
I am using Arcgis Server 10.1 with Javascript API.
Thanks
Samir


have you tried

dojo.number.format(value, {places:2});
0 Kudos
SamirGambhir
Frequent Contributor
have you tried

dojo.number.format(value, {places:2});


Thanks Jeff,
I am not sure where to put this function. Please look at the example in this post and suggest where can I add this function.
Samir
0 Kudos
JeffPace
MVP Alum
my guess is just prior to
stateFeatureLayer.setRenderer(renderer);

you will have to evaluate and modify the renderer

from classbreaksrenderer API
var symbols = dojo.map(results[0].layer.renderer.infos,function(info){
  return  {label: info.label,symbol:info.symbol};
});

seems to indicate that you could override the label with a rounded value
0 Kudos
SamirGambhir
Frequent Contributor
my guess is just prior to
stateFeatureLayer.setRenderer(renderer);

you will have to evaluate and modify the renderer

from classbreaksrenderer API
var symbols = dojo.map(results[0].layer.renderer.infos,function(info){
  return  {label: info.label,symbol:info.symbol};
});

seems to indicate that you could override the label with a rounded value


Thanks, Jeff, for your help. It worked!
Samir
0 Kudos
JeffPace
MVP Alum
awesome happy to help!
0 Kudos