This is a migrated thread and some comments may be shown as answers.

Remove opacity from bar char series

2 Answers 48 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 05 Apr 2013, 02:24 PM
Is there any way to make the bar chartseriesitem non transparent when using the gradient fillstye?  It doesn't seem like this should be the default, and the main / second color opacity is read only.  I have a simple function that builds a couple of series for the chart, and the user wants the bars to not have transparency.

Public Sub SetChartSeries()
 
    Dim oList As New List(Of tblDashboardStat)
    Dim db As New BusIntDataContext
    Dim oSeriesPrior As New ChartSeries
    Dim oSeriesCur As New ChartSeries
 
    oList = (From d In db.tblDashboardStats
             Where d.statGroupID = 1
             Order By d.statSeriesName Descending, d.statSeriesOrder Ascending).ToList
 
    For Each item As tblDashboardStat In oList
 
        Dim oChartSeriesItem As New ChartSeriesItem((item.statSeriesValue1) / 1000000)
 
        oChartSeriesItem.Appearance.Border.Color = Drawing.ColorTranslator.FromHtml(item.statSeriesColor)
        oChartSeriesItem.Appearance.FillStyle.FillType = Styles.FillType.Gradient
        'oChartSeriesItem.Appearance.FillStyle.MainColorOpacity   --->  THIS IS READ ONLY
         
        oChartSeriesItem.Appearance.FillStyle.MainColor = Drawing.ColorTranslator.FromHtml(item.statSeriesColor)
        oChartSeriesItem.ActiveRegion.Tooltip = String.Format("{0:n1}", item.statSeriesValue1)
 
        If item.statSeriesName = "Prior" Then
            oSeriesPrior.Items.Add(oChartSeriesItem)
            hdnColor1.Value = item.statSeriesColor
        Else
            oSeriesCur.Items.Add(oChartSeriesItem)
            hdnColor2.Value = item.statSeriesColor
        End If
 
    Next
 
    rcTotalBilling.Series.Add(oSeriesPrior)
    rcTotalBilling.Series.Add(oSeriesCur)
 
End Sub

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar Kirov
Telerik team
answered on 10 Apr 2013, 01:37 PM
Hi Ryan,

To make the bars non-transparent, when creating the series items, just set the oChartSeriesItem.Appearance.FillStyle.SecondColor property to Color.White or to any other color with alpha = 255 (the default second color for some chart skins is transparent).

I hope this helps.
 
Regards,
Petar Kirov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Ryan
Top achievements
Rank 1
answered on 10 Apr 2013, 02:09 PM
Thanks this works.  I also got around this by adding a complex gradient.

Dim oChartSeriesItem As New ChartSeriesItem((item.statSeriesValue1) / 1000000)
 
oChartSeriesItem.Appearance.Border.Color = Drawing.ColorTranslator.FromHtml(item.statSeriesColor)
oChartSeriesItem.Appearance.FillStyle.FillType = Styles.FillType.ComplexGradient
oChartSeriesItem.Appearance.FillStyle.FillSettings.ComplexGradient.Add(New GradientElement(Drawing.ColorTranslator.FromHtml(item.statSeriesColor), 0))
oChartSeriesItem.Appearance.FillStyle.FillSettings.ComplexGradient.Add(New GradientElement(Drawing.ColorTranslator.FromHtml(item.statSeriesColor), 0.5))
oChartSeriesItem.Appearance.FillStyle.FillSettings.ComplexGradient.Add(New GradientElement(Drawing.Color.White, 1))
Tags
Chart (Obsolete)
Asked by
Ryan
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or