views:

1421

answers:

1

I'm using a Flex ColumnChart with a custom dataTipRenderer. I'm able to apply a nice skin with the dataTipRenderer, but am not sure how to move the datatip to be centered.

Is there a way to have the chart center the data tips over the column instead of the normal top-right alignment the chart does?

Instead of:

      |tip text|
    +++
    +++
    +++
    +++
    +++
    +++
    +++
    +++

I want:

| tip text |
    +++
    +++
    +++
    +++
    +++
    +++
    +++
    +++

Any ideas involving HitData, etc, would be welcome.

+1  A: 

If you have a dataTipRenderer you can set the property x in the main component (canvas, hbox or vbox) like this: x="this.x - (this.width* .5)"

arno
That just sort of shifts the same issue to the left a bit. It's right more of the time, but doesn't work at the right edge.
stevedbrown
i'm not really sure what you want. But the way i'm doing it you can place the dataTip everywhere you want. y property you can set the y position. It is as simple as that.
arno
My bad I see what you mean now. I tested my code on a linechart but on a bar chart it's refusing to work
arno
Your solution works if the chart's container has enough room on the right side for the tip to be displayed. I didn't leave enough padding in the canvas. Pretty simple.
stevedbrown