2011-11-30 95 views
0

我需要在X軸上的Infragistics BarChart中顯示負值。如果我把它用:在X軸上的Infragistics BarChart中顯示負值

chtAgingVsDueAmt.Axis.X.RangeMax = SOME_NEGATIVE_VALUE

它拋出錯誤:

Message: Bad arguments passed to function GetScale Message Details:
at Infragistics.UltraChart.Core.AnInterval.GetScale(Double xmin, Double xmax, Int32 n) at Infragistics.UltraChart.Resources.Appearance.AxisAppearance.SmartAxisTickmarks(IAdvanceAxis axis) at ...

我怎麼能顯示在X軸中的Infragistics BARCHART負值?

+0

什麼是X軸'RangeMin'設置爲? – AakashM

+0

我還沒有設定。我相信當值爲負時,我需要設置RangeMin,否則設置RangeMax。這有意義嗎? –

+0

我相當肯定你需要設置它們兩個,並且你需要確保'RangeMin'小於'RangeMax'。我懷疑給你錯誤的是'RangeMin'仍然是它的默認值(可能爲零),並且你將'RangeMax'設置爲小於'RangeMin',這是不允許的。 – AakashM

回答

3

我與NA 11.2.20112.2025。後面的代碼:

protected void Page_Load(object sender, EventArgs e) 
{ 

    DataTable dt = new DataTable(); 
    dt.Columns.Add("year", typeof(string)); 
    dt.Columns.Add("numUsers", typeof(int)); 
    dt.Rows.Add(new object[] { "2005", -100 }); 
    dt.Rows.Add(new object[] { "2006", 160 }); 
    dt.Rows.Add(new object[] { "2007", -250 }); 
    dt.Rows.Add(new object[] { "2008", 500 }); 
    dt.Rows.Add(new object[] { "2009", -860 }); 
    dt.Rows.Add(new object[] { "2010", 600 }); 
    UltraChart1.Axis.X.RangeMin = -200; 
    UltraChart1.Axis.X.RangeMax = 500; 
    UltraChart1.Data.DataSource = dt; 
    UltraChart1.ChartType = ChartType.BarChart; 
    UltraChart1.Data.DataBind(); 

} 

標記:

<igchart:UltraChart ID="UltraChart1" runat="server" ChartType="BarChart" EmptyChartText="Data Not Available. Please call UltraChart.Data.DataBind() after setting valid Data.DataSource" 
    Version="11.1"> 
    <Effects> 
     <Effects> 
      <igchartprop:GradientEffect /> 
     </Effects> 
    </Effects> 
    <ColorModel AlphaLevel="150" ColorBegin="Pink" ColorEnd="DarkRed" ModelStyle="CustomSkin" 
     Scaling="Oscillating"> 
    </ColorModel> 
    <Axis> 
     <PE ElementType="None" Fill="Cornsilk"></PE> 
     <X Visible="True" TickmarkInterval="40" LineThickness="1" TickmarkStyle="Smart"> 
      <MajorGridLines Visible="True" DrawStyle="Dot" Color="Gainsboro" Thickness="1" AlphaLevel="255"> 
      </MajorGridLines> 
      <MinorGridLines Visible="False" DrawStyle="Dot" Color="LightGray" Thickness="1" AlphaLevel="255"> 
      </MinorGridLines> 
      <Labels ItemFormatString="&lt;DATA_VALUE:00.##&gt;" HorizontalAlign="Far" VerticalAlign="Center" 
       Orientation="VerticalLeftFacing" Font="Verdana, 7pt" FontColor="DimGray"> 
       <SeriesLabels HorizontalAlign="Far" VerticalAlign="Center" Orientation="VerticalLeftFacing" 
        Font="Verdana, 7pt" FontColor="DimGray" FormatString=""> 
        <Layout Behavior="Auto"> 
        </Layout> 
       </SeriesLabels> 
       <Layout Behavior="Auto"> 
       </Layout> 
      </Labels> 
     </X> 
     <Y Visible="True" TickmarkInterval="0" LineThickness="1" TickmarkStyle="Smart"> 
      <MajorGridLines Visible="True" DrawStyle="Dot" Color="Gainsboro" Thickness="1" AlphaLevel="255"> 
      </MajorGridLines> 
      <MinorGridLines Visible="False" DrawStyle="Dot" Color="LightGray" Thickness="1" AlphaLevel="255"> 
      </MinorGridLines> 
      <Labels ItemFormatString="&lt;ITEM_LABEL&gt;" HorizontalAlign="Far" VerticalAlign="Center" 
       Orientation="Horizontal" Font="Verdana, 7pt" FontColor="DimGray"> 
       <SeriesLabels HorizontalAlign="Center" VerticalAlign="Center" Orientation="VerticalLeftFacing" 
        Font="Verdana, 7pt" FontColor="DimGray"> 
        <Layout Behavior="Auto"> 
        </Layout> 
       </SeriesLabels> 
       <Layout Behavior="Auto"> 
       </Layout> 
      </Labels> 
     </Y> 
     <Y2 Visible="False" TickmarkInterval="0" LineThickness="1" TickmarkStyle="Smart"> 
      <MajorGridLines Visible="True" DrawStyle="Dot" Color="Gainsboro" Thickness="1" AlphaLevel="255"> 
      </MajorGridLines> 
      <MinorGridLines Visible="False" DrawStyle="Dot" Color="LightGray" Thickness="1" AlphaLevel="255"> 
      </MinorGridLines> 
      <Labels ItemFormatString="&lt;ITEM_LABEL&gt;" Visible="False" HorizontalAlign="Near" 
       VerticalAlign="Center" Orientation="Horizontal" Font="Verdana, 7pt" FontColor="Gray"> 
       <SeriesLabels HorizontalAlign="Center" VerticalAlign="Center" Orientation="VerticalLeftFacing" 
        Font="Verdana, 7pt" FontColor="Gray"> 
        <Layout Behavior="Auto"> 
        </Layout> 
       </SeriesLabels> 
       <Layout Behavior="Auto"> 
       </Layout> 
      </Labels> 
     </Y2> 
     <X2 Visible="False" TickmarkInterval="40" LineThickness="1" TickmarkStyle="Smart"> 
      <MajorGridLines Visible="True" DrawStyle="Dot" Color="Gainsboro" Thickness="1" AlphaLevel="255"> 
      </MajorGridLines> 
      <MinorGridLines Visible="False" DrawStyle="Dot" Color="LightGray" Thickness="1" AlphaLevel="255"> 
      </MinorGridLines> 
      <Labels ItemFormatString="&lt;DATA_VALUE:00.##&gt;" Visible="False" HorizontalAlign="Far" 
       VerticalAlign="Center" Orientation="VerticalLeftFacing" Font="Verdana, 7pt" FontColor="Gray"> 
       <SeriesLabels HorizontalAlign="Far" VerticalAlign="Center" Orientation="VerticalLeftFacing" 
        Font="Verdana, 7pt" FontColor="Gray" FormatString=""> 
        <Layout Behavior="Auto"> 
        </Layout> 
       </SeriesLabels> 
       <Layout Behavior="Auto"> 
       </Layout> 
      </Labels> 
     </X2> 
     <Z Visible="False" TickmarkInterval="0" LineThickness="1" TickmarkStyle="Smart"> 
      <MajorGridLines Visible="True" DrawStyle="Dot" Color="Gainsboro" Thickness="1" AlphaLevel="255"> 
      </MajorGridLines> 
      <MinorGridLines Visible="False" DrawStyle="Dot" Color="LightGray" Thickness="1" AlphaLevel="255"> 
      </MinorGridLines> 
      <Labels ItemFormatString="" HorizontalAlign="Near" VerticalAlign="Center" Orientation="Horizontal" 
       Font="Verdana, 7pt" FontColor="DimGray" Visible="False"> 
       <SeriesLabels HorizontalAlign="Near" VerticalAlign="Center" Orientation="Horizontal" 
        Font="Verdana, 7pt" FontColor="DimGray"> 
        <Layout Behavior="Auto"> 
        </Layout> 
       </SeriesLabels> 
       <Layout Behavior="Auto"> 
       </Layout> 
      </Labels> 
     </Z> 
     <Z2 Visible="False" TickmarkInterval="0" LineThickness="1" TickmarkStyle="Smart"> 
      <MajorGridLines Visible="True" DrawStyle="Dot" Color="Gainsboro" Thickness="1" AlphaLevel="255"> 
      </MajorGridLines> 
      <MinorGridLines Visible="False" DrawStyle="Dot" Color="LightGray" Thickness="1" AlphaLevel="255"> 
      </MinorGridLines> 
      <Labels ItemFormatString="" Visible="False" HorizontalAlign="Near" VerticalAlign="Center" 
       Orientation="Horizontal" Font="Verdana, 7pt" FontColor="Gray"> 
       <SeriesLabels HorizontalAlign="Near" VerticalAlign="Center" Orientation="VerticalLeftFacing" 
        Font="Verdana, 7pt" FontColor="Gray"> 
        <Layout Behavior="Auto"> 
        </Layout> 
       </SeriesLabels> 
       <Layout Behavior="Auto"> 
       </Layout> 
      </Labels> 
     </Z2> 
    </Axis> 
    <Tooltips Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" 
     Font-Underline="False" /> 
</igchart:UltraChart> 

其顯示我的消極和積極整數無一例外...樣的工程,即使我不設定最小/最大範圍