Hi I have defined a programmatically chart as follows:
ASPX Part:
And on The server part, add Dynamically a scatter series to the Chart:
CS:
But, the labels on the X Axis dosn't changes , and have the numerical label.
I check the link http://www.telerik.com/help/aspnet-ajax/htmlchart-date-axis.html but only works with databound RadHtmlChart which automatically detects the DateTime object data in the column/field and adjusts the distribution of the items on the XAxis.
There is a way to change the labels once defined the series in the server code?
Thanks A lot¡¡¡
Regards
Jorge RR
ASPX Part:
<telerik:RadHtmlChart ID="RadHtmlChartSerie" runat="server" Transitions="true" Skin="Office2007" > <Appearance> <FillStyle BackgroundColor="White"></FillStyle> </Appearance> <ChartTitle> <Appearance Align="Center" BackgroundColor="White" Position="Top"></Appearance> </ChartTitle> <Legend> <Appearance BackgroundColor="White" Position="Bottom"></Appearance> </Legend> <PlotArea> <Appearance> <FillStyle BackgroundColor="White"></FillStyle> </Appearance> <XAxis DataLabelsField="Dia"> <LabelsAppearance RotationAngle="90" /> <TitleAppearance Text="Fecha" /> <MajorGridLines Color="#EFEFEF" Width="1"></MajorGridLines> <MinorGridLines Color="#F7F7F7" Width="1"></MinorGridLines> <TitleAppearance Position="Center" RotationAngle="0" Text="DÃa"></TitleAppearance> </XAxis> <YAxis> <LabelsAppearance /> <TitleAppearance Text="Valor" /> <MajorGridLines Color="#EFEFEF" Width="1"></MajorGridLines> <MinorGridLines Color="#F7F7F7" Width="1"></MinorGridLines> </YAxis> </PlotArea> <ChartTitle Text="Serie Analizada"> </ChartTitle> </telerik:RadHtmlChart>And on The server part, add Dynamically a scatter series to the Chart:
CS:
//Declare a ScatterSeries ScatterSeries pointMinimos = new ScatterSeries(); pointMinimos.Name = "MÃnimo"; pointMinimos.Appearance.FillStyle.BackgroundColor = Color.Green; pointMinimos.LabelsAppearance.Visible = false; pointMinimos.TooltipsAppearance.DataFormatString = "{1}"; pointMinimos.TooltipsAppearance.Color = Color.White;//Fills The ScatterSeries foreach (DataRow dr in dsMaxMin.Tables["dtMinimos"].Rows) { ScatterSeriesItem itemCierre = new ScatterSeriesItem(Convert.ToDecimal(dr["X"].ToString()), Convert.ToDecimal(dr["Y"].ToString())); pointMinimos.SeriesItems.Add(itemCierre); }//Add The series to the Chart with XAxis numerical values RadHtmlChartSerie.PlotArea.Series.Add(pointMinimos);//Clear the XAxis Items RadHtmlChartSerie.PlotArea.XAxis.Items.Clear(); //Here the column "Dia" have a date string foreach (DataRow row in dsMaxMin.Tables["dtMinimos"].Rows) { string formattedLabelText = string.Format("{0:MMMM}", row["Dia"].ToString()); AxisItem newAxisItem = new AxisItem(formattedLabelText); RadHtmlChartSerie.PlotArea.XAxis.Items.Add(newAxisItem); }But, the labels on the X Axis dosn't changes , and have the numerical label.
I check the link http://www.telerik.com/help/aspnet-ajax/htmlchart-date-axis.html but only works with databound RadHtmlChart which automatically detects the DateTime object data in the column/field and adjusts the distribution of the items on the XAxis.
There is a way to change the labels once defined the series in the server code?
Thanks A lot¡¡¡
Regards
Jorge RR