Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
1 row not filling in chart
posted

I have a chart and when there are multiple rows in the dataset everything works fine. When there is one row in the dataset the labels are what they should be but the barchart does not fill. Is there a reason why this is?

 

Here is my code:

 

DataTable dt = new DataTable();
            UltraChart1.ChartType = ChartType.BarChart;
            ChartArea area = new ChartArea();
            area.PE.FillGradientStyle = GradientStyle.Default;
            UltraChart1.CompositeChart.ChartAreas.Add(area);
            UltraChart1.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear;
            Color[] ChartColors;
            ChartColors = new Color[] {Color.Blue};
            UltraChart1.ColorModel.CustomPalette = ChartColors;
            AxisItem xAxisColumn = new AxisItem(this.UltraChart1, AxisNumber.X_Axis);
            AxisItem yAxis = new AxisItem(this.UltraChart1, AxisNumber.Y_Axis);
            xAxisColumn.DataType = AxisDataType.String;
            xAxisColumn.Labels.ItemFormat = AxisItemLabelFormat.ItemLabel;
            yAxis.DataType = AxisDataType.Numeric;
            yAxis.RangeType = AxisRangeType.Custom;
            xAxisColumn.Labels.Orientation = TextOrientation.Horizontal;
            area.Axes.Add(xAxisColumn);
            area.Axes.Add(yAxis);
            ChartLayerAppearance columnLayer = new ChartLayerAppearance();
            columnLayer.AxisX = xAxisColumn;
            columnLayer.AxisY = yAxis;
            columnLayer.ChartArea = area;
            columnLayer.ChartType = ChartType.BarChart;
            ChartLayerAppearance lineLayer = new ChartLayerAppearance();
            this.UltraChart1.CompositeChart.ChartLayers.Add(columnLayer);
            this.UltraChart1.ColumnChart.SeriesSpacing = 0;
            this.UltraChart1.DataSource = ds.Tables[0];
            this.UltraChart1.DataBind();

 

<igchart:UltraChart
                ID="UltraChart1"
                runat="server"
                BackgroundImageFileName=""
                BorderWidth="0px"
                ChartType="BarChart"
                EmptyChartText="Data Not Available. Please call UltraChart.Data.DataBind() after setting valid Data.DataSource"
                Version="6.3"
                BackColor="#F4F6FF"
                BorderColor="Black"
                Legend-BackgroundColor="#F4F6FF"
                 Width="600px"
                 Height="500px">
                <Axis>

<X LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="True">
                       <%-- <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1"
                            Visible="False" />
                        <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1"
                            Visible="True" />--%>
                        <Labels
                            Orientation="horizontal" VerticalAlign="Center" >
                            <Layout Behavior="Auto">
                            </Layout>
                            <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Near"
                                Orientation="horizontal" VerticalAlign="Center">
                                <Layout Behavior="Auto">
                                </Layout>
                            </SeriesLabels>
                            </Labels>
                    </X>

<PE Fill="cornsilk" /></Axis>

<DeploymentScenario ImageURL="../../../ChartImages/Chart_#SEQNUM(100).png" />
            </igchart:UltraChart>

 

Parents
  • 28496
    Verified Answer
    Offline posted

    in this case, the bar is just up against the y-axis.  try setting

    UltraChart1.Data.ZeroAligned = true;

    or setting Axis.X.RangeType = Custom and setting a RangeMin and RangeMax.

Reply Children
No Data