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

Bar Chart structure question

4 Answers 45 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Lynn
Top achievements
Rank 2
Lynn asked on 11 Jun 2010, 04:36 AM
I am working with RadChart for the first time, so I still have a LOT to learn.  There are several things I need to do to this RadWindow, but I'll deal with those after I get the chart right. I have attached a screen copy of my chart as it now exists, and then have three of questions.

Questions:
(1) I do not want the numbers (5, 4, 3, 2, 1) down the left-hand side. Instead, I want the text strings (such as "Something we must have to keep up with our competitors" and "A tool our competitors are using better than we are") in that location on the chart.  It's okay if the text wraps onto multiple lines as long as you can tell which bar on the chart the text is associated with.  Can you tell me how to eliminate the numbers and move the text?

(2) Once the text strings are moved to the left side of the axis, I want them to display in their entirety.  In the attached screen capture, they are cut off after about half of the text is displayed.  Can I accomplish this and, if so, how?

(3) If I wanted to change the color of the bars from gold to, say green, how would I do that?

That's plenty for now.  Sorry to be a pain.  If I can accomplish these 3 items, I'll be happy!

Thanks!

Lynn

4 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 16 Jun 2010, 08:50 AM
Hello Lynn,

Onto your questions:
  1. You can find such example here -- Automatic Text Wrapping
  2. This is controlled by the following property RadChart1.PlotArea.XAxis.Appearance.TextAppearance.MaxLength - its default value is 30, so the ellipsis is added after the 30-th character. You can set it to a larger value like 200.
  3. Here is an example:
RadChart1.Series[0].Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
RadChart1.Series[0].Appearance.FillStyle.MainColor = Color.Green;
Or you can use gradient fill type and provide MainColor and SecondColor. Make sure this code is executed after the chart series are created. In case the chart is databound, you can wire the DataBound event and place the code there.

Hope this helps.

Best regards,
Ves
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lynn
Top achievements
Rank 2
answered on 17 Jun 2010, 07:18 AM
Responding only to my first issue:

(1) I do not want the numbers (5, 4, 3, 2, 1) down the left-hand side. Instead, I want the text strings (such as "Something we must have to keep up with our competitors" and "A tool our competitors are using better than we are") in that location on the chart.  It's okay if the text wraps onto multiple lines as long as you can tell which bar on the chart the text is associated with.  Can you tell me how to eliminate the numbers and move the text?

I'm not exactly certain which values/properties/etc. to change to accomplish the above.  If you look at the attached graphic, I stiill have the values 1 through 5 from bottom to top and the text explanations written next to the bars.  I have included the chart definition and the code-behind for this chart.  Can you tell me what to change to accomplish this, please and thank you?


<telerik:RadChart ID="RadChart1" runat="server" AutoTextWrap="true"   
                Skin="Black" AutoLayout="true" Height="200px" Width="680px" SeriesOrientation="Horizontal">  
                    <Series> 
                        <telerik:ChartSeries DataYColumn="VoteCount" Name="Ten Most Expensive Products">  
                        </telerik:ChartSeries> 
                    </Series> 
                    <PlotArea> 
 
                    </PlotArea> 
                </telerik:RadChart> 

            RadChart1.ChartTitle.TextBlock.Text = "Today's Poll Results" 
            RadChart1.Legend.Visible = False 
            Dim chartSeries As New ChartSeries()  
            chartSeries.Type = ChartSeriesType.Bar  
            Dim reccount As Integer = 0 
 
            Dim cmd As SqlCommand = New SqlCommand(sqlSelectCommand, conn1)  
            Try  
                Dim reader As SqlDataReader = cmd.ExecuteReader()  
                Do While reader.Read()  
                    chartSeries.AddItem(reader("VoteCount"), reader("TextLangShortBody"))  
                    reccountreccount = reccount + 1  
                Loop  
                reader.Close()  
                reader = Nothing 
            Catch ex As Exception  
                Throw New ApplicationException("DataReader Populate Error. Code=" & ex.Message & "sql=" & sqlSelectCommand)  
            Finally  
            End Try  
 

Lynn
0
Accepted
Ves
Telerik team
answered on 17 Jun 2010, 05:36 PM
Hello Lynn,

It's the RadChart1.PlotaArea.XAxis.DataLabelsColumn property that does it. Set it with the name of the column that holds the labels ("TextLangShortBody"). Note, that this would work when the chart is databound. I can you have correctly created the ChartSeries and set it DataYColumn property, so you would not need to create all the chart items manually. Set the DataSource property -- directly with DataReader or extract the data to a DataTable -- and then call DataBind.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Lynn
Top achievements
Rank 2
answered on 19 Jun 2010, 05:39 PM
Ves,

Perfect!  Thanks to all of you for staying with me on this one.  I changed the chart to being databound to a datatable and made the other changes and it all came out great.  I still have some fine tuning to do, but I'm beginning to understand the chart control better.

I attached a screen capture of the way it is right now.   Thanks again!

Lynn
Tags
Chart (Obsolete)
Asked by
Lynn
Top achievements
Rank 2
Answers by
Ves
Telerik team
Lynn
Top achievements
Rank 2
Share this question
or