Two Things that I'm having trouble with...

Thread is closed for posting
5 posts, 0 answers
  1. Dan Schmecker
    Dan Schmecker avatar
    13 posts
    Member since:
    Dec 2009

    Posted 17 Dec 2009 Link to this post

    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() 
  2. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 18 Dec 2009 Link to this post

    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 

  3. Dan Schmecker
    Dan Schmecker avatar
    13 posts
    Member since:
    Dec 2009

    Posted 18 Dec 2009 Link to this post

    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
  4. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 18 Dec 2009 Link to this post

    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 :)


  5. Dan Schmecker
    Dan Schmecker avatar
    13 posts
    Member since:
    Dec 2009

    Posted 21 Dec 2009 Link to this post

    Thanks. That worked perfectly.
Back to Top