1

I have created a mapfile with a piechart and I want to add labels to the various pieces of the pie.

The layer in the mapfile is defined as follows:

LAYER 
DATA "Test"
NAME "Test"
METADATA
    WMS_TITLE "Test"
    WMS_ABSTRACT "Test"
    WMS_SRS "EPSG:28992"
    WFS_TITLE "Test"
    RESULT_FIELDS "Test"
END
SIZEUNITS PIXELS
STATUS ON
TOLERANCE 10
TOLERANCEUNITS PIXELS
DUMP TRUE
TYPE CHART
PROCESSING "CHART_TYPE=PIE"
PROCESSING "CHART_SIZE=30"
UNITS METERS
MAXSCALEDENOM 150000
LABELITEM "item"
CLASS
    NAME "object1"
    STYLE
        SIZE [size]
        COLOR 44 162 95
        OUTLINECOLOR 0 0 0
    END
    LABEL
        COLOR 0 0 0
        OUTLINECOLOR 225 225 0
        #MINDISTANCE 500
        MINFEATURESIZE AUTO
        #OFFSET 0 0
        #ANGLE AUTO
        TYPE TRUETYPE
        FONT arial
        SIZE 2
        #ANTIALIAS TRUE
        #POSITION CC
        #PARTIALS FALSE
    END 
END
CLASS
    NAME "object2"
    STYLE
        SIZE [size]
        COLOR 69 130 189
        OUTLINECOLOR 0 0 0
    END
END 
END

The mapfile is working, I see the piecharts. However, the labelling is not working.

Does anyone know how I can make this work? Or is this not possible?

  • I suppose you have read mapserver.org/output/dynamic_charting.html. It is all documentation that I have found about charts and it does not tell anything about labels. However, because there are classes which are named they may appear in legends. Perhars reading about those helps you mapserver.org/output/html_legend.html. For improved charts write about your ideas into mapserver users mailing list. – user30184 Sep 10 '14 at 14:59
  • That is indeed all documentation I have found as well. Nothing about labelling. I don't understand I how can use html legend in labelling? – Stefan Sep 15 '14 at 11:12
  • Mapserver developers do not seem to follow Stackexchange actively. Send mail to mapserver-users and hope that you will get an answer from there. I have a feeling that charts are not widely used with MapServer. – user30184 Sep 15 '14 at 11:30
  • I was trying also and have found no way to label the pieces - at least via normal labeling techniques. I had a quick scan through the code and couldn't see any provision for labeling. The best you could do is add the layer again and add the chart values as a label that sits on top of the chart i.e 5/10/25/60 – luke bassett Feb 6 '15 at 5:31
1

You have to create other layers, one for each part of the graph, with filter, configure them as a point without dressing, but with label.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.