I have a composite chart with columns and two different lines as follows
iColChart.ChartType = Styles.ChartType.Composite Dim area As New Appearance.ChartArea Dim xAxisColumn As New Appearance.AxisItem Dim aColumn As String() = Nothing Dim aLine As String() = Nothing
xAxisColumn.axisNumber = Styles.AxisNumber.X_Axis xAxisColumn.DataType = Styles.AxisDataType.String xAxisColumn.SetLabelAxisType = SetLabelAxisType.GroupBySeries xAxisColumn.MajorGridLines.Visible = False xAxisColumn.MinorGridLines.Visible = False xAxisColumn.Labels.ItemFormat = Styles.AxisItemLabelFormat.ItemLabel area.Axes.Add(xAxisColumn)
Dim xAxisLine As New Appearance.AxisItem xAxisLine.axisNumber = Styles.AxisNumber.X_Axis xAxisLine.DataType = Styles.AxisDataType.String xAxisLine.TickmarkInterval = 0.1 xAxisLine.SetLabelAxisType = SetLabelAxisType.ContinuousData xAxisLine.MajorGridLines.Visible = False xAxisLine.MinorGridLines.Visible = False xAxisLine.Margin.Near.MarginType = Styles.LocationType.Percentage xAxisLine.Margin.Near.Value = 7 xAxisLine.Margin.Far.MarginType = Styles.LocationType.Percentage xAxisLine.Margin.Far.Value = 7 area.Axes.Add(xAxisLine)
Dim yAxisColumn As New Appearance.AxisItem yAxisColumn.axisNumber = Styles.AxisNumber.Y_Axis yAxisColumn.DataType = Styles.AxisDataType.Numeric yAxisColumn.TickmarkInterval = 0.1 yAxisColumn.RangeMax = 7 yAxisColumn.RangeMin = 0 yAxisColumn.RangeType = Styles.AxisRangeType.Custom yAxisColumn.TickmarkStyle = Styles.AxisTickStyle.Smart yAxisColumn.MajorGridLines.Visible = False yAxisColumn.MinorGridLines.Visible = False yAxisColumn.Labels.ItemFormat = Styles.AxisItemLabelFormat.DataValue area.Axes.Add(yAxisColumn)
Dim yAxisLine As New Appearance.AxisItem yAxisLine.axisNumber = Styles.AxisNumber.Y2_Axis yAxisLine.DataType = Styles.AxisDataType.Numeric yAxisLine.TickmarkInterval = 0.1 yAxisLine.RangeMax = 7 yAxisLine.RangeMin = 0 yAxisColumn.RangeType = Styles.AxisRangeType.Custom yAxisLine.TickmarkStyle = Styles.AxisTickStyle.Smart yAxisLine.MajorGridLines.Visible = False yAxisLine.MinorGridLines.Visible = False area.Axes.Add(yAxisLine) area.Bounds = New Rectangle(0, 10, 100, 90) area.BoundsMeasureType = Styles.MeasureType.Percentage
Dim seriesColumn As New Appearance.NumericSeries aColumn = GetChartColumnSeriesArray(userProfile, choice) seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(0), "1st Qtr", False)) seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(1), "2nd Qtr", False)) seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(2), "3rd Qtr", False)) tblChart4.Rows(1).Cells(1).Text = aColumn(0) tblChart4.Rows(1).Cells(2).Text = aColumn(1) tblChart4.Rows(1).Cells(3).Text = aColumn(2)
aLine = GetChartLineSeriesArray(userProfile, choice) Dim seriesLine As New Appearance.NumericSeries seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(0), "1st Qtr", False)) seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(1), "2nd Qtr", False)) seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(2), "3rd Qtr", False)) tblChart4.Rows(2).Cells(1).Text = aLine(0) tblChart4.Rows(2).Cells(2).Text = aLine(1) tblChart4.Rows(2).Cells(3).Text = aLine(2)
Dim seriesLine2 As New Appearance.NumericSeries seriesLine2.Points.Add(New Appearance.NumericDataPoint(4.5, "1st Qtr", False)) seriesLine2.Points.Add(New Appearance.NumericDataPoint(4.5, "2nd Qtr", False)) seriesLine2.Points.Add(New Appearance.NumericDataPoint(4.5, "3rd Qtr", False)) tblChart4.Rows(2).Cells(1).Text = 4.5 tblChart4.Rows(2).Cells(2).Text = 4.5 tblChart4.Rows(2).Cells(3).Text = 4.5
iColChart.CompositeChart.Series.Add(seriesColumn) iColChart.CompositeChart.Series.Add(seriesLine)
Dim columnLayer As New Appearance.ChartLayerAppearance columnLayer.ChartType = Styles.ChartType.ColumnChart ColumnLayer.AxisX = xAxisColumn ColumnLayer.AxisY = yAxisColumn ColumnLayer.ChartArea = area ColumnLayer.Series.Add(seriesColumn) iColChart.CompositeChart.ChartLayers.Add(columnLayer)
Dim LineLayer As New Appearance.ChartLayerAppearance LineLayer.ChartType = Styles.ChartType.LineChart LineLayer.AxisX = xAxisLine LineLayer.AxisY = yAxisColumn LineLayer.ChartArea = area LineLayer.Series.Add(seriesLine) iColChart.CompositeChart.ChartLayers.Add(LineLayer)
Dim LineLayer2 As New Appearance.ChartLayerAppearance LineLayer2.ChartType = Styles.ChartType.LineChart LineLayer2.AxisX = xAxisLine LineLayer2.AxisY = yAxisColumn LineLayer2.ChartArea = area LineLayer2.Series.Add(seriesLine2) iColChart.CompositeChart.ChartLayers.Add(LineLayer2)
iColChart.Data.ZeroAligned = True iColChart.Data.MaxValue = 7 iColChart.Data.MinValue = 0 iColChart.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear iColChart.ColorModel.CustomPalette = New Color() {Color.Blue, Color.Yellow, Color.Green, Color.Purple} iColChart.Section508Compliant = True iColChart.TitleTop.Text = choice iColChart.CompositeChart.ChartAreas.Add(area)
Dim columnAppearance As New Appearance.ColumnChartAppearance columnAppearance.ColumnSpacing = 1 columnLayer.ChartTypeAppearance = columnAppearance
Dim legend As New Appearance.CompositeLegend iColChart.CompositeChart.Legends.Add(legend) legend.ChartLayers.Add(columnLayer) legend.ChartLayers.Add(LineLayer) legend.Bounds = New Rectangle(10, 245, 375, 17)
with the resulting chart
I can't seem to change the 2nd line to a different color. Using the FillSceneGraph, I am only able to change polyline, which changes both, but what I want is for each line to have a different color. Is there a way to do this?
It may just be something flaky with my monitor. I haven't had the screen reviewed outside of development yet. Thanks Max!
I ran your code but didn't get the behavior you described. The only thing I changed was the data, everything else was the same. Here's the screen shot of what I get:
Here is the vb code and html
iColChart.ChartType = Styles.ChartType.Composite Dim area As New Appearance.ChartArea Dim xAxisColumn As New Appearance.AxisItem Dim aColumn As String() = Nothing Dim aLine As String() = Nothing Dim aLine1 As String() = Nothing
Dim xAxisLine As New Appearance.AxisItem xAxisLine.axisNumber = Styles.AxisNumber.X_Axis xAxisLine.DataType = Styles.AxisDataType.String xAxisLine.TickmarkInterval = 0.1 xAxisLine.SetLabelAxisType = SetLabelAxisType.ContinuousData xAxisLine.MajorGridLines.Visible = False xAxisLine.MinorGridLines.Visible = False xAxisLine.Margin.Near.MarginType = Styles.LocationType.Percentage xAxisLine.Margin.Near.Value = 6 xAxisLine.Margin.Far.MarginType = Styles.LocationType.Percentage xAxisLine.Margin.Far.Value = 6 area.Axes.Add(xAxisLine)
Dim yAxisColumn As New Appearance.AxisItem yAxisColumn.axisNumber = Styles.AxisNumber.Y_Axis yAxisColumn.DataType = Styles.AxisDataType.Numeric yAxisColumn.TickmarkInterval = 0.1 yAxisColumn.RangeMax = 8 yAxisColumn.RangeMin = 3.5 yAxisColumn.RangeType = Styles.AxisRangeType.Custom yAxisColumn.TickmarkStyle = Styles.AxisTickStyle.Smart yAxisColumn.MajorGridLines.Visible = False yAxisColumn.MinorGridLines.Visible = False yAxisColumn.Labels.ItemFormat = Styles.AxisItemLabelFormat.DataValue area.Axes.Add(yAxisColumn)
Dim yAxisLine As New Appearance.AxisItem yAxisLine.axisNumber = Styles.AxisNumber.Y2_Axis yAxisLine.DataType = Styles.AxisDataType.Numeric yAxisLine.TickmarkInterval = 0.1 yAxisLine.RangeMax = 8 yAxisLine.RangeMin = 0 yAxisColumn.RangeType = Styles.AxisRangeType.Custom yAxisLine.TickmarkStyle = Styles.AxisTickStyle.Smart yAxisLine.MajorGridLines.Visible = False yAxisLine.MinorGridLines.Visible = False area.Axes.Add(yAxisLine) area.Bounds = New Rectangle(0, 10, 100, 90) area.BoundsMeasureType = Styles.MeasureType.Percentage
aColumn = GetChartColumnLineSeriesArray(userProfile, choice, 0) Dim seriesColumn As New Appearance.NumericSeries seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(0), "1st Qtr", False)) seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(1), "2nd Qtr", False)) seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(2), "3rd Qtr", False)) seriesColumn.Points.Add(New Appearance.NumericDataPoint(aColumn(3), "4th Qtr", False)) tblChart4.Rows(1).Cells(1).Text = aColumn(0) tblChart4.Rows(1).Cells(2).Text = aColumn(1) tblChart4.Rows(1).Cells(3).Text = aColumn(2) tblChart4.Rows(1).Cells(4).Text = aColumn(3)
aLine = GetChartColumnLineSeriesArray(userProfile, choice, 1) Dim seriesLine As New Appearance.NumericSeries seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(0), "1st Qtr", False)) seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(1), "2nd Qtr", False)) seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(2), "3rd Qtr", False)) seriesLine.Points.Add(New Appearance.NumericDataPoint(aLine(3), "4th Qtr", False)) tblChart4.Rows(2).Cells(1).Text = aLine(0) tblChart4.Rows(2).Cells(2).Text = aLine(1) tblChart4.Rows(2).Cells(3).Text = aLine(2) tblChart4.Rows(2).Cells(4).Text = aLine(3)
aLine = GetChartColumnLineSeriesArray(userProfile, choice, 2) Dim seriesLine2 As New Appearance.NumericSeries Dim pe As New Appearance.PaintElement(Color.Red) seriesLine2.PEs.Add(pe) seriesLine2.Points.Add(New Appearance.NumericDataPoint(aLine(0), "1st Qtr", False)) seriesLine2.Points.Add(New Appearance.NumericDataPoint(aLine(1), "2nd Qtr", False)) seriesLine2.Points.Add(New Appearance.NumericDataPoint(aLine(2), "3rd Qtr", False)) seriesLine2.Points.Add(New Appearance.NumericDataPoint(aLine(3), "4th Qtr", False)) tblChart4.Rows(3).Cells(1).Text = aLine(0) tblChart4.Rows(3).Cells(2).Text = aLine(1) tblChart4.Rows(3).Cells(3).Text = aLine(2) tblChart4.Rows(3).Cells(4).Text = aLine(3)
Dim columnLayer As New Appearance.ChartLayerAppearance columnLayer.ChartType = Styles.ChartType.ColumnChart columnLayer.AxisX = xAxisColumn columnLayer.AxisY = yAxisColumn columnLayer.ChartArea = area columnLayer.Series.Add(seriesColumn) iColChart.CompositeChart.ChartLayers.Add(columnLayer)
Dim LineLayer2 As New Appearance.ChartLayerAppearance LineLayer2.ChartType = Styles.ChartType.LineChart LineLayer2.AxisX = xAxisLine LineLayer2.AxisY = yAxisColumn LineLayer2.ChartArea = area LineLayer2.Series.Add(seriesLine2) iColChart.CompositeChart.ChartLayers.Add(LineLayer2) iColChart.Data.ZeroAligned = True iColChart.Data.MaxValue = 7.5 iColChart.Data.MinValue = 0 iColChart.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear iColChart.ColorModel.CustomPalette = New Color() {Color.Blue, Color.Yellow, Color.Green, Color.Purple} iColChart.Section508Compliant = True iColChart.TitleTop.Text = choice iColChart.CompositeChart.ChartAreas.Add(area)
<igchart:UltraChart ID="igChart4" runat="server" BackgroundImageFileName="" BorderColor="Black" BorderWidth="1px" ChartType="ColumnLineChart" EmptyChartText="Data Not Available" SplineAreaChart-LineDrawStyle="Solid" Style="position: relative" Version="8.1"> <DeploymentScenario ImageType="Jpeg" /> <Data MaxValue="7" MinValue="0" ZeroAligned="True" ></Data> <Effects> <Effects> <igchartprop:GradientEffect> </igchartprop:GradientEffect> </Effects> </Effects> <ColorModel AlphaLevel="150" ColorBegin="Green" ColorEnd="DarkRed" ModelStyle="CustomRandom"> </ColorModel> <Axis> <PE ElementType="None" Fill="Cornsilk" /> <X LineThickness="1" TickmarkInterval=".1" TickmarkStyle="Smart" Visible="True" Extent="30"> <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="<ITEM_LABEL>" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </X> <Y LineThickness="1" TickmarkInterval=".1" 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" FontColor="DimGray" HorizontalAlign="Far" ItemFormatString="<DATA_VALUE:00.##>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="DimGray" FormatString="" HorizontalAlign="Far" Orientation="VerticalLeftFacing" VerticalAlign="Center" > <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y> <Y2 LineThickness="1" TickmarkInterval=".1" 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" FontColor="Gray" HorizontalAlign="Near" ItemFormatString="<DATA_VALUE:00.##>" Orientation="Horizontal" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Near" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <Layout Behavior="Auto"> </Layout> </SeriesLabels> <Layout Behavior="Auto"> </Layout> </Labels> </Y2> <X2 LineThickness="1" TickmarkInterval="0" 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" FontColor="Gray" HorizontalAlign="Far" ItemFormatString="<ITEM_LABEL>" Orientation="VerticalLeftFacing" VerticalAlign="Center"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" FormatString="" HorizontalAlign="Far" Orientation="Horizontal" 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" Visible="False"> <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" Visible="False"> <SeriesLabels Font="Verdana, 7pt" FontColor="Gray" HorizontalAlign="Near" Orientation="Horizontal" VerticalAlign="Center"> <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" /> <Legend Location="Bottom" Visible="True"></Legend></igchart:UltraChart>
This might be due to some existing effects being enabled, though I'm not completely sure why a different color is being used other than the one you've set. If you still haven't figured it out, maybe you can post some of your new code here and we'll take a look.
It seems to have only "lightened" the green, rather than change it to red, but I'll keep playing with it.