OpenWaterFoundation / owf-app-infomapper-ng

Open Water Foundation InfoMapper web application for menu-driven maps and visualizations, using Angular
GNU General Public License v3.0
1 stars 2 forks source link

Allow property/variable notation in classification file for labels #108

Open smalers opened 4 years ago

smalers commented 4 years ago

This issue is important but may take some iterations to implement. It can be evaluated but other items are higher priority.

The labels shown in the legend for a category symbol are important because they help the understand the data. Currently, for the category classification file the label must be literal strings. It is a pain to format these manually because are basically transcribing source data into the label. It would be good to move to some automated labeling. It would be good to start phasing in some flexibility. For example, allow the label to use a property notation like the following to format the label to display DISTRICT and NAME attribute values. The left side indicates the scope and the right side is a lookup variable.

${layer.attribute.value:DISTRICT}, ${layer.attribute.value:NAME}

I'm torn whether it should just be ${layer.attribute} but I can see layer.attribute.value and layer.attribute.name being used. The above is saying "insert the layer attribute value for attribute named DISTRICT. We'll have to see if this is confusing.

Going forward it would be good to figure out how to specify this once to apply for all rows, but for now it would be repeated for each table row in the table column. The code would figure out how to replace the pattern ${layer.attribute:DISTRICT} with the value of the DISTRICT matching the value column item. Literal strings would still be supported.

Then, have the issue of formatting the values, in particular for floating point values and date/times. For example, for floating point values, might need to do something like:

format("%10.3f",${layer.attribute.value.AREA})
round(${layer.attribute.value.AREA},2)

or

${layer.attribute.value.AREA}).format("%10.3f")
${layer.attribute.value.AREA}).round(2)

The first syntax is a function, whereas the second I tend to call a "modifier". TSTool uses the modifier approach for modifying date/times, for example in SetInputPeriod commands.

smalers commented 4 years ago

This is similar to issue #37.