ArcGIS.com Map Support Date Field Labels?

4058
6
02-26-2015 10:39 AM
DanAllen
Occasional Contributor III

I have a hosted feature service in ArcGIS.com added to an ArcGIS.com web map.  When I tell it to create labels, the date field from my attributes is not visible as a selection choice.

Can you label the date field or only text fields?

Dan

Tags (1)
0 Kudos
6 Replies
Randall_ERaymond
Occasional Contributor III

If the date field/attribute is available in your data then you can have it show up when you configure your "Pop-Up" for your web map. After you have open your web map look for the "Configure Pop-Up" under the dropdown of your data layer.

0 Kudos
DanAllen
Occasional Contributor III

Hi Randall,

The date shows up just fine in the pop-up.  When i select "create labels" it gives you a selector to pick which attribute fields to label.  my date field does not show up.

Dan

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hi Dan,

I'm going to look into the issue reported to see if this has been reported as a bug. As a workaround, you can manually type in your date field name between the curly brackets in the create labels text box, example: {date_time}, and your date field will be labeled.

Thanks,

Kelly

RomanChueh
New Contributor III

Hi Kelly,

I am having a similar issue as Dan, and I have manually type in the DateTime field name in the create labels Text box, as you have suggested.  But, the label only display the Date value and not the Time value, example: only 5/1/2015 display in the label for datetime value 5/1/2015 10:00:00.  How do I format the DateTime value to have it display correctly?

Thanks,

Roman

0 Kudos
KellyGerrow
Esri Frequent Contributor

Hi Roman,

Currently this functionality is not available in ArcGIS Online.

0 Kudos
RomanChueh
New Contributor III

Thanks Kelly.

I am consuming my WebMap in a Javascript app, and it appears I have an option is to do client-side labeling using labelingInfo with LabelClass or a LabelLayer, but similar to ArcGIS Online, both methods display the Date part of the date_time field.  Do you have any suggestion or work around for labeling client-side Javascript app?

Regards,

Roman

// Label Class

var labelClass = new LabelClass({
  labelExpression
: '[date_time]',       <=  no REST API formatting of label?
  labelPlacement
: 'always-horizontal',
});

var labelingInfos= []

labelingInfos.push(labelClass)

layer.setLabelingInfo(labelingInfos);

// Label Layer

var textColor = new Color("red");

var textLabel = new TextSymbol().setColor(textColor);

textLabel.font.setSize("14pt");

textLabel.font.setFamily("arial");

textLabelRenderer = new SimpleRenderer(textLabel);

var labels = new LabelLayer({

      id: "labels"

});

labels.addFeatureLayer(layer, textLabelRenderer, "${date_time}");   <= no info windows template date formatting?

map.addLayer(labels);

0 Kudos