0 Replies Latest reply on Jun 24, 2009 12:34 AM by lvpho85

    Help, my chart-problem columns

    lvpho85

      hello.
      i used adobe flex build 3.0. Now i had problem about my chart
      i want to create LineChart. I have date. And my date update  minute by minute. My chart  have 16 spaces
      : (8h-9h), (9h-10h)....(22h-23h).

       

      I want my chart show as the picture blow:

       

      http://i365.photobucket.com/albums/oo97/tuyetton/helpflex-2.png

       

      Or

       

      http://i365.photobucket.com/albums/oo97/tuyetton/helpflex.png

       

      But Now i don't know how i can like.
      i only created as the picture blow:
      http://i365.photobucket.com/albums/oo97/tuyetton/helpflex-3.png

       

      The columns are not standar, not same Identical.Pls See clear the Picture above and blow and Help me
      Now my Code

       

       

      <?xml version="1.0"?>
      <!-- http://blog.flexexamples.com/2007/11/19 … ick-marks/ -->
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
              layout="vertical"
              verticalAlign="middle"
              backgroundColor="white">

       

          <mx:Script>
              <![CDATA[
                  import mx.charts.HitData;
                  import mx.charts.CategoryAxis;
                  import mx.charts.chartClasses.IAxis;
                  import  mx.charts.GridLines;
                  import mx.collections.ArrayCollection;
                  import mx.graphics.Stroke;
                  import mx.events.ColorPickerEvent;           
                 
                 
                  private function linearAxis_labelFunc(item:Object, prevValue:Object, axis:IAxis):String
                  {
                      return currFormatter.format(item);               
                  }
                  private function categoryAxis_labelFunc(item:Object, prevValue:Object, axis:CategoryAxis, categoryItem:Object):String
                  {                                               
                      return item.valueOf().toString();            
                  } 
                  private function renderTips(hd:HitData):String
                  {
                    return "aaaaaaaaaaaaaa bbbbbbbbbbb";
                  }

       

               
              ]]>
          </mx:Script>
          <mx:CurrencyFormatter id="currFormatter" precision="2" />  
          <mx:XMLListCollection id="dp12">
              <mx:source>
                  <mx:XMLList>
                      <quote date="8h" open="90.1" />
                      <quote open="90.1" /> 
                      <quote open="90.1" />                                
                      <quote date="9h"  open="45.5" /> 
                      <quote open="90.1" /> 
                      <quote open="90.1" />         
                      <quote date="10h" open="40.82" />                                           
                      <quote date="11h" open="21.4"  />                
                      <quote date="12h" open="40.41"  />              
                      <quote date="13h" open="40.55"  />
                      <quote date="14h" open="40.18" />             
                      <quote date="15h" open="39.83"  />               
                      <quote date="16h" open="40.22" /> 
                      <quote open="90.1" /> 
                      <quote open="90.1" />                
                      <quote date="17h" open="41.01" /> 
                      <quote date="18h" open="41.21"   />                
                      <quote date="19h" open="32.00" />                 
                      <quote date="20h" open="45.00" />               
                      <quote date="21h" open="29"/>              
                      <quote date="22h" open="30.00" />              
                      <quote date="23h" open="40" />                             
                      </mx:XMLList>
              </mx:source>
          </mx:XMLListCollection>     
          <mx:LineChart id="lineChart" showDataTips="true" color="black"
              dataProvider="{dp12}"  width="100%" height="100%" alpha="1.0"
               >
              <!-- background elements -->
              <mx:backgroundElements>
                  <mx:GridLines id="gridLines" toolTip="Tony adam" direction="both"
                      horizontalTickAligned="true" themeColor="red" alpha="5">                              
                      <mx:horizontalFill>
                          <mx:SolidColor color="white" alpha="5.0"  />
                      </mx:horizontalFill>               
                      <mx:horizontalAlternateFill>
                          <mx:SolidColor color="white" alpha="5.0" />
                      </mx:horizontalAlternateFill>                                             
                  </mx:GridLines>
              </mx:backgroundElements>
              <!-- vertical axis -->
              <mx:verticalAxis>
                  <mx:LinearAxis baseAtZero="true"
                          title="Price"
                           />
              </mx:verticalAxis>
              <!-- horizontal axis -->
              <mx:horizontalAxis>
                  <mx:CategoryAxis id="ca"
                          categoryField="@date"
                          title="Tháng 6 Năm 2009"
                          />
              </mx:horizontalAxis>
              <!-- horizontal axis renderer -->
             <mx:horizontalAxisRenderers>
                  <!--<mx:AxisRenderer axis="{ca}" canDropLabels="false" />-->
                  <mx:AxisRenderer canDropLabels="true" placement="bottom"
                  axis="{ca}" tickPlacement="inside"
                  tickLength="100" minorTickPlacement="inside"
                  minorTickLength="15"      
                  />   
              </mx:horizontalAxisRenderers>
              <!-- series -->
              <mx:series>                              
                   <mx:LineSeries yField="@open" displayName="open" xField="@date"
                       interpolateValues="true" form="curve" themeColor="black">
                    <mx:lineStroke>
                          <mx:Stroke color="#3333FF" weight="1" alpha="3.1" scaleMode="vertical"/>               
                   </mx:lineStroke>
                   </mx:LineSeries>     
              </mx:series>      
              <!-- series filters -->
              <mx:seriesFilters>
                  <mx:Array />
              </mx:seriesFilters>
          </mx:LineChart>   
      </mx:Application>