Search code examples
apache-flexactionscriptflex4flex-chartingflex-charts

Reduce padding between axis labels and tick markers on Flex charts


I have a mx.charts.LineChart in Flex and I would like to know how to reduce the padding between the value labels and the tick markers? I've highlighted the region I mean with yellow boxes in the image below.

I'd like the labels to be as close as possible to the tick markers, just a couple of pixels will do.

I only care about applying this to the x-axis.

I'd also be interested to know how to reduce the padding between the axis title (e.g. kB and minutes on chart below) and the value labels.

Flex Chart


Solution

  • Use the labelGap style of the AxisRenderer class.

    By default it is 3 pixels, you can set it to 0 (or even a negative value if still not close enough).

    For positioning the axis title there is no easy solution. You could write the vertical axis title yourself, as a label on top left of the chart. An advantage is that it is much better for the user to read (than the vertical writing).