User (Legacy) Posted September 14, 2005 Report Share Posted September 14, 2005 How can I change the colors of the bars in a single series depending on a value in a db table? You see in the chart below how the data repeats? Each section needs to be another color. My code looks like this. 'Set the charts main title chartName.Titles(0).Text = vTitle chartName.Titles(1).Text = vSubTitle Dim da As OracleDataAdapter = New OracleDataAdapter Dim ds As DataSet = New DataSet Dim con As OracleConnection = New OracleConnection(conStr) Try chartName.CrossHairs = True chartName.AxisX.LabelAngle = 90 chartName.SerLegBox = True chartName.SerLegBoxObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Near chartName.SerLegBoxObj.Docked = SoftwareFX.ChartFX.Docked.Bottom chartName.DataSourceSettings.DataType.Item(0) = SoftwareFX.ChartFX.DataType.NotUsed 'business chartName.DataSourceSettings.DataType.Item(1) = SoftwareFX.ChartFX.DataType.KeyLegend 'region chartName.DataSourceSettings.DataType.Item(2) = SoftwareFX.ChartFX.DataType.Label 'month chartName.DataSourceSettings.DataType.Item(3) = SoftwareFX.ChartFX.DataType.Value 'expected invoice tons chartName.Series(0).Gallery = SoftwareFX.ChartFX.Gallery.Bar chartName.Series(0).Legend = "Expected Invoice Tons" chartName.Series(0).YAxis = SoftwareFX.ChartFX.YAxis.Secondary chartName.DataSourceSettings.DataType.Item(4) = SoftwareFX.ChartFX.DataType.Value 'budget tons chartName.Series(1).Gallery = SoftwareFX.ChartFX.Gallery.Lines chartName.Series(1).LineWidth = 3 chartName.Series(1).MarkerShape = SoftwareFX.ChartFX.MarkerShape.Circle chartName.Series(1).Legend = "Budget Tons" chartName.Series(1).YAxis = SoftwareFX.ChartFX.YAxis.Main Dim cmd As OracleCommand = New OracleCommand(vSql, con) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("rs", OracleType.Cursor).Direction = ParameterDirection.Output da.SelectCommand = cmd da.Fill(ds) chartName.DataSource = ds chartName.DataBind() Finally CType(con, IDisposable).Dispose() End Try setDefaults(chartName) My Data looks like this. Link to comment Share on other sites More sharing options...
User (Legacy) Posted September 14, 2005 Author Report Share Posted September 14, 2005 Sorry, here is the chart. "Tony Gray" <tonygray216@gmail.com> wrote in message news:Y8t5mTUuFHA.1040@webserver3.softwarefx.com... How can I change the colors of the bars in a single series depending on a value in a db table? You see in the chart below how the data repeats? Each section needs to be another color. My code looks like this. 'Set the charts main title chartName.Titles(0).Text = vTitle chartName.Titles(1).Text = vSubTitle Dim da As OracleDataAdapter = New OracleDataAdapter Dim ds As DataSet = New DataSet Dim con As OracleConnection = New OracleConnection(conStr) Try chartName.CrossHairs = True chartName.AxisX.LabelAngle = 90 chartName.SerLegBox = True chartName.SerLegBoxObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Near chartName.SerLegBoxObj.Docked = SoftwareFX.ChartFX.Docked.Bottom chartName.DataSourceSettings.DataType.Item(0) = SoftwareFX.ChartFX.DataType.NotUsed 'business chartName.DataSourceSettings.DataType.Item(1) = SoftwareFX.ChartFX.DataType.KeyLegend 'region chartName.DataSourceSettings.DataType.Item(2) = SoftwareFX.ChartFX.DataType.Label 'month chartName.DataSourceSettings.DataType.Item(3) = SoftwareFX.ChartFX.DataType.Value 'expected invoice tons chartName.Series(0).Gallery = SoftwareFX.ChartFX.Gallery.Bar chartName.Series(0).Legend = "Expected Invoice Tons" chartName.Series(0).YAxis = SoftwareFX.ChartFX.YAxis.Secondary chartName.DataSourceSettings.DataType.Item(4) = SoftwareFX.ChartFX.DataType.Value 'budget tons chartName.Series(1).Gallery = SoftwareFX.ChartFX.Gallery.Lines chartName.Series(1).LineWidth = 3 chartName.Series(1).MarkerShape = SoftwareFX.ChartFX.MarkerShape.Circle chartName.Series(1).Legend = "Budget Tons" chartName.Series(1).YAxis = SoftwareFX.ChartFX.YAxis.Main Dim cmd As OracleCommand = New OracleCommand(vSql, con) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("rs", OracleType.Cursor).Direction = ParameterDirection.Output da.SelectCommand = cmd da.Fill(ds) chartName.DataSource = ds chartName.DataBind() Finally CType(con, IDisposable).Dispose() End Try setDefaults(chartName) My Data looks like this. Link to comment Share on other sites More sharing options...
Software FX Posted September 14, 2005 Report Share Posted September 14, 2005 Dear Tony, I think you need to have a read of the ConditionalAttributes API in the programmer's guide. That architecture is good if you want to color all bars red beyond a certian YValue Meaning all the ones higher then 16000 will be red. However, you did write "depending on a value in a db table" so I suggest ConditionalAttributes But you also wrote Each section needs to be another color. The way to achive that is by using PointAttributes and coloring say Point[0,0].Color =Color. Red; You would have to do that programatically and thus know exactly how many point are in each month. Another option is to rearrange the data so you have a series for each Region (Japan, NorthAmerica ..) then use the dates as the X-Axis Hope this helps. -c "Tony Gray" <tonygray216@gmail.com> wrote in message news:Johv1VUuFHA.1040@webserver3.softwarefx.com... Sorry, here is the chart. "Tony Gray" <tonygray216@gmail.com> wrote in message news:Y8t5mTUuFHA.1040@webserver3.softwarefx.com... How can I change the colors of the bars in a single series depending on a value in a db table? You see in the chart below how the data repeats? Each section needs to be another color. My code looks like this. 'Set the charts main title chartName.Titles(0).Text = vTitle chartName.Titles(1).Text = vSubTitle Dim da As OracleDataAdapter = New OracleDataAdapter Dim ds As DataSet = New DataSet Dim con As OracleConnection = New OracleConnection(conStr) Try chartName.CrossHairs = True chartName.AxisX.LabelAngle = 90 chartName.SerLegBox = True chartName.SerLegBoxObj.Alignment = SoftwareFX.ChartFX.ToolAlignment.Near chartName.SerLegBoxObj.Docked = SoftwareFX.ChartFX.Docked.Bottom chartName.DataSourceSettings.DataType.Item(0) = SoftwareFX.ChartFX.DataType.NotUsed 'business chartName.DataSourceSettings.DataType.Item(1) = SoftwareFX.ChartFX.DataType.KeyLegend 'region chartName.DataSourceSettings.DataType.Item(2) = SoftwareFX.ChartFX.DataType.Label 'month chartName.DataSourceSettings.DataType.Item(3) = SoftwareFX.ChartFX.DataType.Value 'expected invoice tons chartName.Series(0).Gallery = SoftwareFX.ChartFX.Gallery.Bar chartName.Series(0).Legend = "Expected Invoice Tons" chartName.Series(0).YAxis = SoftwareFX.ChartFX.YAxis.Secondary chartName.DataSourceSettings.DataType.Item(4) = SoftwareFX.ChartFX.DataType.Value 'budget tons chartName.Series(1).Gallery = SoftwareFX.ChartFX.Gallery.Lines chartName.Series(1).LineWidth = 3 chartName.Series(1).MarkerShape = SoftwareFX.ChartFX.MarkerShape.Circle chartName.Series(1).Legend = "Budget Tons" chartName.Series(1).YAxis = SoftwareFX.ChartFX.YAxis.Main Dim cmd As OracleCommand = New OracleCommand(vSql, con) cmd.CommandType = CommandType.StoredProcedure cmd.Parameters.Add("rs", OracleType.Cursor).Direction = ParameterDirection.Output da.SelectCommand = cmd da.Fill(ds) chartName.DataSource = ds chartName.DataBind() Finally CType(con, IDisposable).Dispose() End Try setDefaults(chartName) My Data looks like this. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.