1 Reply Latest reply on Feb 24, 2010 6:07 PM by Jim.Dibble

    In ColumnChart, how to stop displaying small column for zero value?

    Jim.Dibble

      I'm trying to create a ColumnChart that does not display a column when the value is zero. The chart currently looks like this:

      ColumnChart.gif.gif

      This is a stacked column chart with red values representing Faults and green values representing Throughput. Each hour has an explicit value of zero for Faults. I don't want to see any red lines when the value is zero. Is there any way to accomplish this?

       

      My code looks like this:

       

      <mx:Script><![CDATA[

           import mx.collections.ArrayCollection;

           [Bindable]
           public var simpleStats:ArrayCollection = new ArrayCollection([
              {Hour:"0:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                   AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
              {Hour:"1:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                   AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
              {Hour:"2:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                   AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
              {Hour:"3:00", Throughput:5, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                   AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0},    
              {Hour:"4:00", Throughput:0, ThroughputThreshold:2000, Faults:0, MaxResponseTime:450, AvgResponseTime:200, MinResponseTime:180,
                   AuthenticationAcceptance:50, AuthenticationRejection:0, AuthorizationAcceptance:50, AuthorizationRejection:0}
           ]);            
                       
        ]]></mx:Script>

       

      ...

                                       <mx:ColumnChart id="trafficChart"
                                          dataProvider="{simpleStats}"
                                          showDataTips="true" width="500" height="100%" seriesFilters="[]"
                                          type="stacked">
                                          <mx:verticalAxis>
                                              <mx:LinearAxis title="Messages" id="a1"/>
                                          </mx:verticalAxis>                                   
                                          <mx:horizontalAxis>
                                             <mx:CategoryAxis
                                                     id="TrafficTimeAxis"
                                                  dataProvider="{simpleStats}"
                                                  categoryField="Hour"
                                                  />
                                          </mx:horizontalAxis>
                                          <mx:horizontalAxisRenderers>
                                              <mx:AxisRenderer axis="{TrafficTimeAxis}" canDropLabels="true"/>                                       
                                          </mx:horizontalAxisRenderers>                                            
                                          <mx:series>                                                                         
                                             <mx:ColumnSeries
                                                  yField="Faults"
                                                  displayName="Faults"
                                                  fill="{sc2}"
                                                  stroke="{s2}"
                                                   minHeight="0">
                                             </mx:ColumnSeries>                                                                                                          
                                             <mx:ColumnSeries
                                                  yField="Throughput"
                                                  displayName="Throughput"
                                                  fill="{sc1}"
                                                  stroke="{s1}"
                                                  minHeight="0">

                                              </mx:ColumnSeries>                                      
                                          </mx:series>
                                       </mx:ColumnChart>