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

Point Chart Series Display Problem

3 Answers 107 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 18 Aug 2010, 02:30 PM
Hi,

I am admittedly a RadChart newbie so I hope that my problem doesn't draw too many sighs and head-nods.

My goal is to put up a point chart with two series.  The first series contains a bunch of x/y coordinates from an SQL view.  The second series should consist of only one point in the average(x)/average(y) position.  I am close but something is wrong.  On my ASPX page I have this:

<asp:SqlDataSource ID="dsBeliefMap" runat="server" ConnectionString="<%$ ConnectionStrings:Databaseaipoll1 %>"></asp:SqlDataSource>
<telerik:RadChart ID="RadChart1" SkinsOverrideStyles="true" PlotArea-XAxis-MinValue="0" PlotArea-XAxis-MaxValue="1" PlotArea-YAxis-MinValue="0" PlotArea-YAxis-MaxValue="1" Legend-Visible="true" runat="server" DatasourceID="dsBeliefMap" ChartTitle-TextBlock-Text="Belief Map" DefaultType="Point" Width="300" Height="275">
<Series>
<telerik:ChartSeries Name="Votes" Type="Point" DataYColumn="CertaintyPercent" DataXColumn="SupportPercent" DefaultLabelValue=""></telerik:ChartSeries>
 
</Series>
</telerik:RadChart>

In my VB codebehind, I have this:

dsBeliefMap.SelectCommand = "SELECT SupportPercent, CertaintyPercent FROM vwSearch WHERE SearchID = " & CStr(Session("CurrentSearchID"))
 
Dim AverageBelief As New ChartSeries
AverageBelief.Name = "Average"
AverageBelief.DefaultLabelValue = ""
AverageBelief.Type = ChartSeriesType.Point
Dim avgb As New ChartSeriesItem
avgb.XValue = 0.2 ' Will replace with avg(x) value
avgb.YValue = 0.2 ' Will replace with avg(y) value
avgb.PointAppearance.Visible = True
AverageBelief.AddItem(avgb)
RadChart1.Series.Add(AverageBelief)
RadChart1.EnableAjaxSkinRendering = True
RadChart1.DataBind()

The chart does display all "Votes" series items and displays both series' names in the legend but does not display the programmatically-generated point at the .2/.2 location. 

What am I missing?

Thanks,

Paul.

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 23 Aug 2010, 11:29 AM
Hello Paul,

When DataBind() is called RadChart will either only respect series with DataYColumn set i.e. there is something to plot or create series for all numeric properties in the datasource if there is no series with DataYColumn set. In order to add another series manually, please move the code which adds it to the chart after the call to DataBind method.

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
Paul
Top achievements
Rank 1
answered on 23 Aug 2010, 03:04 PM
Ves,

Thanks for your reply.  Unfortunately placing the code after the DataBind or even removing the DataBind statement does not make my secondary series (consisting of 1 item) visible.  I also notice that other properties are being ignored.  I wonder whether these are related symtoms.  For example, I set my XAxis.AxisLabel.TextBlock.Text to a value but that value doesn't show -- only the numerical values.  Below is codebehind followed by the ASPX.  Attached is an image of the chart that is rendered:

 

dsBeliefMap.SelectCommand = "SELECT SupportPercent, CertaintyPercent FROM vwSearch WHERE SearchID = " & CStr(Session("CurrentSearchID"))
RadChart1.Legend.Visible = True
'RadChart1.DataBind()
RadChart1.IntelligentLabelsEnabled = False
RadChart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Belief"
'RadChart1.PlotArea.XAxis.Appearance.LabelAppearance.Visible = False
RadChart1.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Certainty"
Dim AverageBelief As New ChartSeries
AverageBelief.Name = "Average"
AverageBelief.DefaultLabelValue = ""
AverageBelief.Type = ChartSeriesType.Point
Dim avgb As New ChartSeriesItem
avgb.XValue = 0.2
avgb.YValue = 0.2
avgb.PointAppearance.Visible = True
AverageBelief.AddItem(avgb)
RadChart1.Series.Add(AverageBelief)
RadChart1.PlotArea.XAxis.AutoScale = True
RadChart1.PlotArea.YAxis.AutoScale = True

 ASPX Code:


 

<asp:SqlDataSource ID="dsBeliefMap" runat="server" ConnectionString="<%$ ConnectionStrings:Databaseaipoll1 %>"></asp:SqlDataSource>
<telerik:RadChart ID="RadChart1" SkinsOverrideStyles="false" PlotArea-XAxis-MinValue="0" PlotArea-XAxis-MaxValue="1" AutoLayout="true" PlotArea-YAxis-MinValue="0" PlotArea-YAxis-MaxValue="1" PlotArea-XAxis-AxisLabel-TextBlock-Text = "Belief" runat="server" DatasourceID="dsBeliefMap" ChartTitle-TextBlock-Text="Belief Map" DefaultType="Point" Width="285" Height="275">
<Series>
<telerik:ChartSeries Name="Votes" Type="Point" DataYColumn="CertaintyPercent" DataXColumn="SupportPercent" DefaultLabelValue=""></telerik:ChartSeries>
</Series>
</telerik:RadChart>

So I have 2 questions:  Why does the programmatically-generated series not show a green point at the .2/.2 position (despite the fact that the legend acknowledges the series? and why do my axislabels show numbers rather than the text that I set programmatically (RadChart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Belief")?

Any help you can give me would be very much appreciated.

Thanks,

Paul.

 

 

 

0
Ves
Telerik team
answered on 24 Aug 2010, 11:21 AM
Hi Paul,

Please, find attached a small example, which shows correctly both - the databound series and the manually added one.

As for the labels - setting the <Axis>.AxisLabel.TextBlock.Text actually sets the axis label text, but it does not provide a column name for databinding the axis labels. This is shown in this help topic. Still, you do not see that label as the <Axis>.AxisLable.Visible property is not set to true.

Now, the individual axis item labels -- XAxis has a property which serves this need -- DataLabelsColumn. However, it might not fit well the scenario with ChartSeries.DataXColumn as with XAxis.DataLabelsColumn the chart will create an item in XAxis for each item in the datasource. These ChartAxisItems will have incremental values - 1, 2, 3, ... and this will not match the XValues of the ChartSeriesItems. This is why the example shows how to map the desired labels to the axis items manually.

Sincerely,
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
Tags
Chart (Obsolete)
Asked by
Paul
Top achievements
Rank 1
Answers by
Ves
Telerik team
Paul
Top achievements
Rank 1
Share this question
or