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

[Solved] Two Things that I'm having trouble with...

4 Answers 127 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Dan Schmecker
Top achievements
Rank 1
Dan Schmecker asked on 17 Dec 2009, 08:50 PM

After trying it for awhile...and i can't seem to figure out 2 things:
(programaticly in vb.net)
1) How do you manipulate the style (font, color,etc.) of Series Item Labels?
2) In an Area-type chart, how do you alter the color gradient of a given series? Like how would you make it a solid color or keep the gradient but make it les severe?

Thanks.

Below is the code I'm using to generate the chart:

Dim sqlDataSource As New SqlDataSource()  
        sqlDataSource.ID = "myDataSource" 
 
 
        sqlDataSource.ConnectionString = "Data Source=xxxxxxxxxxxxx" 
          
        sqlDataSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure  
        sqlDataSource.SelectCommand = "sla_iap" 
        sqlDataSource.SelectParameters.Add("Param1", p1)  
        sqlDataSource.SelectParameters.Add("Param2", p2)  
        sqlDataSource.SelectParameters.Add("Param3", p3)  
 
 
        Me.Page.Controls.Add(sqlDataSource)  
 
        RadChart1.Skin = "Colorful" 
        RadChart1.Appearance.FillStyle.MainColor() = Drawing.Color.Cornsilk  
        RadChart1.Appearance.FillStyle.SecondColor() = Drawing.Color.Brown  
        RadChart1.PlotArea.Appearance.Border.Width = "1" 
        RadChart1.ChartTitle.Appearance.Border.Visible = False 
        RadChart1.ChartTitle.Appearance.FillStyle.MainColor = Drawing.Color.Cornsilk  
        RadChart1.ChartTitle.TextBlock.Text = "Maintenance Met / Missed Trending Report For All Incidents" 
 
        RadChart1.DefaultType = Telerik.Charting.ChartSeriesType.StackedSplineArea100  
        RadChart1.AutoLayout = True 
        RadChart1.PlotArea.YAxis.Appearance.TextAppearance.TextProperties.Color = Drawing.Color.Black  
        RadChart1.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Color = Drawing.Color.Black  
        RadChart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = "90" 
        RadChart1.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate  
        RadChart1.PlotArea.XAxis.DataLabelsColumn = "WeekRestored" 
        RadChart1.ChartTitle.TextBlock.Appearance.TextProperties.Font = New System.Drawing.Font("Arial", 14, Drawing.FontStyle.Regular)  
        RadChart1.ChartTitle.TextBlock.Appearance.TextProperties.Color = Drawing.Color.CadetBlue  
      
        RadChart1.DataSourceID = "myDataSource" 
        RadChart1.DataBind() 

4 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 18 Dec 2009, 04:12 PM
I think these lines of code should help you out :)

 
myFirstSeries.Items(0).Label.TextBlock.Appearance.TextProperties.Color = System.Drawing.Color.Wheat 
myFirstSeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Gradient 
'myFirstSeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid 
myFirstSeries.Appearance.FillStyle.MainColor = System.Drawing.Color.Tan 
myFirstSeries.Appearance.FillStyle.SecondColor = System.Drawing.Color.SteelBlue 

0
Dan Schmecker
Top achievements
Rank 1
answered on 18 Dec 2009, 05:53 PM
Thanks for the response.

The one thing that confuses me is the "myFirstSeries" part.
The Series that i have in this Chart are spelled out by the result data set from the sql stored procedure....so I didn't have to specificly declare a Series....they were already there.
How do i explicitly declare a Series and make sure that it matches the column of data from sql results?

Thanks,
DS
0
Schlurk
Top achievements
Rank 2
answered on 18 Dec 2009, 06:24 PM
You can always access the series in a few different ways once it's in there. My code was just built from an app I have where I define my own ChartSeriesItems etc. and build it from scratch. You can do this for example:

 
Dim mySeries As ChartSeries = RadChart1.Series(0) 


You could also fill a DataTable with whatever you return from your DataBase and then do something like this:
 
Dim mySeriesItem As ChartSeriesItem 
Dim myFirstSeries As ChartSeries 
mySeriesItem.XValue = myCount 
mySeriesItem.YValue = Convert.ToInt32(ds.Tables(0).Rows(0)(myColumn.ColumnName)) 
myFirstSeries.Items.Add(mySeriesItem) 
RadChart1.Series.Add(myFirstSeries) 

Hopefully this helps a little further :)


0
Dan Schmecker
Top achievements
Rank 1
answered on 21 Dec 2009, 03:05 PM
Thanks. That worked perfectly.
Tags
Chart (Obsolete)
Asked by
Dan Schmecker
Top achievements
Rank 1
Answers by
Schlurk
Top achievements
Rank 2
Dan Schmecker
Top achievements
Rank 1
Share this question
or