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

Problems when using Xaxis labelling and Scrolling.

3 Answers 174 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Tarun Kataria
Top achievements
Rank 1
Tarun Kataria asked on 08 Aug 2008, 12:32 AM
Initially I had Q1 release and in that X axis labelling and scrolling didn't work together. Now after installing Q2 release labelling and scrolling works together but now the chart do not show any series. Below is the .ascx code. Please help.

<

telerik:RadChart ID="RadChart1" AutoLayout="true"

runat="server" Width="495px"

Skin="DeepBlue" EnableViewState="false">

<ClientSettings EnableZoom="false" ScrollMode="XOnly" XScale="2" />

<ChartTitle>

<Appearance Dimensions-Margins="4%, 10px, 14px, 6%">

<FillStyle MainColor="">

</FillStyle>

</Appearance>

<TextBlock>

<Appearance TextProperties-Color="White"

TextProperties-Font="Verdana, 14pt">

</Appearance>

</TextBlock>

</ChartTitle>

<Legend>

<Appearance Dimensions-Margins="1px, 2%, 12%, 1px">

<ItemTextAppearance TextProperties-Color="White">

</ItemTextAppearance>

<FillStyle GammaCorrection="False" MainColor="37, 255, 255, 255">

</FillStyle>

<Border Color="76, 255, 255, 255" />

</Appearance>

<TextBlock>

<Appearance Position-AlignedPosition="Top" TextProperties-Color="LightSkyBlue">

</Appearance>

</TextBlock>

</Legend>

<PlotArea>

<Appearance Dimensions-Margins="18%, 24%, 22%, 10%"></Appearance>

<XAxis LayoutMode="Normal" AutoScale="false">

<Appearance ValueFormat="ShortTime" MajorGridLines-Visible="false">

<LabelAppearance RotationAngle="90" Position-AlignedPosition="Top">

</LabelAppearance>

</Appearance>

</XAxis>

<YAxis IsZeroBased="false">

</YAxis>

</PlotArea>

</

telerik:RadChart>

3 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 08 Aug 2008, 04:16 PM
Hi Tarun Kataria,

We are unable to reproduce the problematic behavior in our local tests -- we have attached a sample application that uses your ASCX markup and the chart is bound to some sample data (as the markup does not define any ChartSeries, nor data).

You can also review this online example here that demonstrates how to display DateTime data on the numerical axis of RadChart -- the key is to convert the DateTime object to double value via .ToOADate( ) call.

Hope this helps.


Sincerely yours,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tarun Kataria
Top achievements
Rank 1
answered on 13 Aug 2008, 10:11 PM
Hi There.

Yeah your code work but I was using series instead of DataTable so I tried that with your code and that also works. But the issue is that when I try to add X axis label by using the below line

RadChart1.PlotArea.XAxis.AddRange(seriesStart.ToOADate(), seriesEnd.ToOADate(), minuteStep*60);

For your convenience I am hereby pasting the same code which you sent me but with my modifications.

The .cs file is as below

using

System;

using

System.Data;

using

System.Configuration;

using

System.Collections;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

using

System.Web.UI.WebControls;

using

System.Web.UI.WebControls.WebParts;

using

System.Web.UI.HtmlControls;

using

Telerik.Web.UI;

using

Telerik.Charting;

 

public

partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

const double hourStep = 1 / 24.0;

const double minuteStep = hourStep / 60;

//DataTable dt = new DataTable();

//dt.Columns.Add("Data", typeof(double));

ChartSeries _chartSeries = new ChartSeries();

_chartSeries.Type =

ChartSeriesType.Line;

for (int i = 0; i < 20; i++)

{

//DataRow dr = dt.NewRow();

//dr["Data"] = 20 - i;

//dt.Rows.Add(dr);

_chartSeries.AddItem(i);

}

//RadChart1.DefaultType = ChartSeriesType.Line;

//RadChart1.DataSource = dt;

//RadChart1.DataBind();

RadChart1.Series.Add(_chartSeries);

string start = "08/01/2008";

string end = "08/02/2008";

DateTime seriesStart = Convert.ToDateTime(start);

DateTime seriesEnd = Convert.ToDateTime(end);

//Commenting the below line mkes the chart work but uncommenting it and you can see only scrolling and lables but no series

RadChart1.PlotArea.XAxis.AddRange(seriesStart.ToOADate(), seriesEnd.ToOADate(), minuteStep*60);

}

}

The .ascx file is same as what you sent. Only one thing is to be noted on the .ascx file is that when we make AutoScale attribute in Xaxis as true it works but then we are adding the Xaxis lables programatticaly so we set it to false and hence it doesnt work.

<

telerik:RadChart ID="RadChart1" AutoLayout="true" runat="server" Width="495px" Skin="DeepBlue"

 

EnableViewState="false">

 

<ClientSettings EnableZoom="false" ScrollMode="XOnly" XScale="2" />

 

<ChartTitle>

 

<Appearance Dimensions-Margins="4%, 10px, 14px, 6%">

 

<FillStyle MainColor="">

 

</FillStyle>

 

</Appearance>

 

<TextBlock>

 

<Appearance TextProperties-Color="White" TextProperties-Font="Verdana, 14pt">

 

</Appearance>

 

</TextBlock>

 

</ChartTitle>

 

<Legend>

 

<Appearance Dimensions-Margins="1px, 2%, 12%, 1px">

 

<ItemTextAppearance TextProperties-Color="White">

 

</ItemTextAppearance>

 

<FillStyle GammaCorrection="False" MainColor="37, 255, 255, 255">

 

</FillStyle>

 

<Border Color="76, 255, 255, 255" />

 

</Appearance>

 

<TextBlock>

 

<Appearance Position-AlignedPosition="Top" TextProperties-Color="LightSkyBlue">

 

</Appearance>

 

</TextBlock>

 

</Legend>

 

<PlotArea>

 

<Appearance Dimensions-Margins="18%, 24%, 22%, 10%">

 

</Appearance>

 

<XAxis LayoutMode="Normal" AutoScale="false">

 

<Appearance ValueFormat="ShortTime" MajorGridLines-Visible="false">

 

<LabelAppearance RotationAngle="90" Position-AlignedPosition="Top">

 

</LabelAppearance>

 

</Appearance>

 

</XAxis>

 

<YAxis IsZeroBased="false">

 

</YAxis>

 

</PlotArea>

 

</telerik:RadChart>


I played with the two highlighted attribute above and if you have ScrollMode=true and AutoScale=false then no data points are displayed on the chart. So please try this sample and let me know how can I make custom labelling and scrolling work together.

Thanks

0
Giuseppe
Telerik team
answered on 18 Aug 2008, 11:18 AM
Hello Tarun Kataria,

Thank you for elaborating on this further. Indeed we were able to reproduce the problematic behavior with the provided code and we must confirm this is a bug within the control related to the enabled scaling in this scenario. We have forwarded this issue to our developers for further review but at the moment we could suggest you as a workaround to manually supply a correct XValue for each series item you create thus the series will be properly visible:

for (int i = 0; i < 20; i++) 
    ChartSeriesItem item = new ChartSeriesItem(); 
    item.XValue = seriesStart.ToOADate() + hourStep * i; 
    iitem.YValue = i; 
    _chartSeries.Items.Add(item); 


We have attached a modified sample application as well. We have also updated your Telerik points for the report.


All the best,
Manuel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Tarun Kataria
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Tarun Kataria
Top achievements
Rank 1
Share this question
or