I am having a simple problem. My data looks like this
Date AppleCount OrangeCount BananaCount
01/01/1990 100 200 300
....
01/01/2008 300 400 800
I am trying display this in line chart, and I did SwapRowsAndColumns="True" , Works fine but when I say show legend it shows all the rows in the legend, Basically what I want is 3 items in the legend - Apple, Orange and Banana . But infragistics autometically shows all the rows as legends. how to fix this ??
Infact I want column name to be my legends
I've been trying this:
table.Columns.Add("Date", typeof(DateTime));
table.Columns.Add("Orange", typeof(double));
table.Rows.Add(new object[ { DateTime.Now, 100, 200, 300 });
table.Rows.Add(new object[ { DateTime.Now.AddDays(2), 400, 500, 200 });
this.UltraChart1.Legend.Visible = true;
this.UltraChart1.DataBind();
And the legend shows Apple, Orange, Banana.
Could you attach your project so we can investigate the problem?
Sorry for the delay... Here is my code
<igchart:UltraChart ID="UltraChart1" runat="server" ChartType="LineChart" Version="8.1" Width="250px" Height="150px" EmptyChartText="Data Not Available. " Section508Compliant="True" BackgroundImageFileName="" Visible="True" DataSourceID="ObjectDataSource1"> <TitleBottom Visible="False" HorizontalAlign="Far" Location="Bottom" Extent="0"> <Margins Top="0" Left="0" Right="0" Bottom="0"></Margins> </TitleBottom> <Data SwapRowsAndColumns="True" RowLabelsColumn="0" UseMinMax="True"> <EmptyStyle LegendDisplayType="Point"> <PointStyle CharacterFont="Microsoft Sans Serif, 7.8pt"> </PointStyle> <LineStyle DrawStyle="Dash" /> </EmptyStyle> </Data> <Border CornerRadius="5"></Border> <TitleLeft Location="Left" Extent="33" Visible="True"> </TitleLeft> <TitleRight Location="Right" Extent="33" Visible="True"> </TitleRight> <ColorModel AlphaLevel="150" ColorBegin="Red" ColorEnd="Black" ModelStyle="CustomSkin" Scaling="Increasing"> <Skin ApplyRowWise="False"> <PEs> <igchartprop:PaintElement Fill="0, 51, 102" FillStopColor="Green"> </igchartprop:PaintElement> <igchartprop:PaintElement Fill="102, 102, 51" FillGradientStyle="Horizontal" FillStopColor="Goldenrod"> </igchartprop:PaintElement> <igchartprop:PaintElement Fill="153, 51, 51" FillGradientStyle="Horizontal" FillStopColor="Black"> </igchartprop:PaintElement> </PEs> </Skin> </ColorModel> <Axis> <Y Extent="30" LineThickness="1" TickmarkInterval="2" TickmarkStyle="Smart" Visible="True"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" HorizontalAlign="Far" ItemFormatString="<DATA_VALUE:##.#>%" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" FormatString="" HorizontalAlign="Far" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y> <PE ElementType="None" Fill="Cornsilk" /> <X Extent="20" LineThickness="1" TickmarkInterval="1" TickmarkStyle="DataInterval" Visible="True" TickmarkIntervalType="Years"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" HorizontalAlign="Center" ItemFormatString="<ITEM_LABEL:yy>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" HorizontalAlign="Near" Orientation="VerticalLeftFacing" VerticalAlign="Center" FormatString="<ITEM_LABEL>" Visible="False"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="UseCollection"> <BehaviorCollection> <igchartprop:FontScalingAxisLabelLayoutBehavior EnableRollback="False"> </igchartprop:FontScalingAxisLabelLayoutBehavior> <igchartprop:WrapTextAxisLabelLayoutBehavior> </igchartprop:WrapTextAxisLabelLayoutBehavior> <igchartprop:StaggerAxisLabelLayoutBehavior> </igchartprop:StaggerAxisLabelLayoutBehavior> <igchartprop:RotateAxisLabelLayoutBehavior> </igchartprop:RotateAxisLabelLayoutBehavior> <igchartprop:FontScalingAxisLabelLayoutBehavior EnableRollback="False" MinimumSize="5.9"> </igchartprop:FontScalingAxisLabelLayoutBehavior> <igchartprop:WrapTextAxisLabelLayoutBehavior> </igchartprop:WrapTextAxisLabelLayoutBehavior> <igchartprop:StaggerAxisLabelLayoutBehavior> </igchartprop:StaggerAxisLabelLayoutBehavior> <igchartprop:RotateAxisLabelLayoutBehavior> </igchartprop:RotateAxisLabelLayoutBehavior> <igchartprop:ClipTextAxisLabelLayoutBehavior> </igchartprop:ClipTextAxisLabelLayoutBehavior> </BehaviorCollection> </Layout> </Labels> </X> <Y2 LineThickness="1" TickmarkInterval="2" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="<DATA_VALUE:00.##>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y2> <X2 LineThickness="1" TickmarkInterval="1" TickmarkStyle="Smart" Visible="False" TickmarkIntervalType="Weeks"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Far" ItemFormatString="<ITEM_LABEL>" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Far" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </X2> <Z LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" ItemFormatString="" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Z> <Z2 LineThickness="1" TickmarkInterval="0" TickmarkStyle="Smart" Visible="False"> <MajorGridLines AlphaLevel="255" Color="Gainsboro" DrawStyle="Dot" Thickness="1" Visible="True" /> <MinorGridLines AlphaLevel="255" Color="LightGray" DrawStyle="Dot" Thickness="1" Visible="False" /> <Labels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Z2> </Axis> <LineChart EndStyle="ArrowAnchor" HighLightLines="True" MidPointAnchors="False" Thickness="10" TreatDateTimeAsString="False"> </LineChart> <Legend FormatString="<SERIES_LABEL>"></Legend> <Tooltips Font-Bold="True" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" FormatString="<DATA_VALUE:##.#>%" Padding="3" /> <DeploymentScenario ImageURL="ChartImages/Chart_#SEQNUM(1000).png" /> </igchart:UltraChart>
And my data looks like this
Date Apple Banana Orange
you are currently using ColorModel.ModelStyle = CustomSkin, with ColorModel.Skin.ApplyRowWise = false. this is the problem.
since Data.SwapRowsAndColumns is true, each column is treated as a row - so Apple, Banana, and Orange are all rows. each date is treated as a column.
Therefore, set
this.UltraChart1.ColorModel.Skin.ApplyRowWise = true;
and you should get the desired result.
I was having the same issue .. this fixed me right up.
Thanks for the feedbackPeter