views:

1613

answers:

8

I want to use small flex charts with just 3 labels, for example a chart over the past 2 hours , with 3 horizontal label, as shown below:

  |       |        |    
9:46    10:46    11:46

(of course, there are more than 3 values to display!)

I have been told this is not trivial, but how would you do it?

Also, do you know of any books that present how to achieve sophisticated layouts in Flex? The books I have found are code-oriented and usually limit formatting to a minimum, and it's not always straightforward to connect the names of attributes to what you are trying to do.

+2  A: 

Take a look in the online Flex Language Guide at the AxisRenderer class.

It also has some helpful sample code and output.

defmeta
The example I found in the documentation of AxisRenderer did not answer my question. I believe the solution involves overwriting the constructor. This is why I asked the question on this forum. Flex can do wonderful things easily, but some simple things are devilishly hard to do.
A: 

The example I found in the documentation of AxisRenderer did not answer my question. I believe the solution involves overwriting the constructor. This is why I asked the question on this forum. Flex can do wonderful things easily, but some simple things are devilishly hard to do.

A: 

Have you looked at the CategoryAxis type? Using this you can explicitly set the labels.

eduffy
A: 

I tried giving a different dataprovider in the CategoryAxis of the chart, but the line just disappeared

[Bindable]
  private var expenses2:ArrayCollection=new ArrayCollection(); // computed elsewhere
  private var labels:ArrayCollection=new ArrayCollection( [
           { Time: "10:38"},
           { Time: "11:08"},
           { Time: "11:38"},
       ]); 
...
<mx:LineChart  dataProvider="{expenses2}"  ...>
        <mx:backgroundElements>... </mx:backgroundElements>
        <mx:horizontalAxis>
           <mx:CategoryAxis 
                dataProvider="{labels}" 
                categoryField="Time"
           />
A: 

I think you need "[Bindable]" before every variable you want to use as a dataProvider, so one more before labels.

eduffy
A: 

has anyone implemented this? even i am looking for something very similar to this.

A: 

i have same problem, please anyone help me..to implement chart with interval time like this topic...

tubagus Saepul A
A: 

I am looking for the solution for that as well

maoanz