Posted
on Mar 22, 2011
(permalink)
Hi Vladimir Milev
Thank you
i am facing one problem
Below is my code
<telerik:RadChart ID="chart" ChartTitle-Appearance-Visible="false" IntelligentLabelsEnabled="true" OnItemDataBound="chart_ItemDataBound"
runat="server" Skin="Web20" SkinsOverrideStyles="false" AutoTextWrap="true" SeriesOrientation="Vertical"
AutoLayout="true" Visible="false" Width="1000px">
<ChartTitle >
<TextBlock>
<Appearance TextProperties-Color="#555555" TextProperties-Font="Arial, 16pt">
</Appearance>
</TextBlock>
</ChartTitle>
<Appearance Border-Color="#cccccc">
<FillStyle MainColor="#f9f9f9" SecondColor="#e9e9e9" FillSettings-GradientMode="Vertical" >
</FillStyle>
</Appearance>
<Legend Appearance-Location="OutsidePlotArea" Appearance-Position-AlignedPosition="Top">
</Legend>
</telerik:RadChart>
c#
private void BindChart()
{
chart.Visible = true;
chart.PlotArea.XAxis.Clear();
chart.PlotArea.YAxis.Clear();
chart.Appearance.Corners.RoundSize = 10;
chart.Appearance.Corners.TopLeft = Telerik.Charting.Styles.CornerType.Round;
chart.Appearance.Corners.BottomRight = Telerik.Charting.Styles.CornerType.Round;
chart.Appearance.Corners.BottomLeft = Telerik.Charting.Styles.CornerType.Round;
chart.Appearance.Corners.TopRight = Telerik.Charting.Styles.CornerType.Round;
DataTable tbl = new DataTable();
tbl = GenerateDataTable();
chart.PlotArea.XAxis.IsZeroBased = false;
chart.PlotArea.XAxis.AutoScale = false;
chart.PlotArea.XAxis.Appearance.ValueFormat = ChartValueFormat.ShortDate;
chart.PlotArea.XAxis.Appearance.CustomFormat = "MMM yyyy";
chart.PlotArea.YAxis.Appearance.CustomFormat = "#,#";
chart.Legend.Appearance.ItemTextAppearance.MaxLength = 1000;
for (int i = 0; i < 12; i++)
{
for (int j = 0; j < tbl.Rows.Count; j++)
{
DateTime start = Convert.ToDateTime(tbl.Rows[j]["EventStartDate"]);
if (start.AddMonths(i).ToOADate() == start.ToOADate())
{
ChartAxisItem item = new ChartAxisItem();
item.Value = (decimal)start.AddMonths(i).ToOADate();
chart.PlotArea.XAxis.AddItem(item);
}
}
}
chart.DataSource = tbl;
chart.DataBind();
}
private DataTable GenerateDataTable()
{
DataTable tbl = new DataTable();
tbl = GettableData();
DataTable tbl2 = new DataTable();
DataColumn col = new DataColumn("Date");
col.DataType = typeof(DateTime);
tbl2.Columns.Add(col);
col = new DataColumn(col1);
col.DataType = typeof(double);
tbl2.Columns.Add(col);
col = new DataColumn(col2);
col.DataType = typeof(double);
tbl2.Columns.Add(col);
for (int i = 0; i < tbl.Rows.Count; i++)
{
if (dt.Month == 1)
{
if (janImm > 0)
{
tbl2.Rows.RemoveAt(tbl2.Rows.Count - 1);
}
janImm = janImm + Convert.ToDouble(tbl.Rows[i]["TotalImmediateMonetizedSavings"]);
janAcc = janAcc + Convert.ToDouble(tbl.Rows[i]["TotalAnnualizedMonitizedSavings"]);
string s = janImm.ToString("N");
string s1 = janAcc.ToString("N");
// janImm = Convert.ToDouble(s);
tbl2.Rows.Add(new object[] { check, janImm, janAcc });
}
}
return tbl2;
}
The problem in the above code is that the series are all in the Datatable tbl2 where date , col1 , col2 are there
I need to display the chart serie values as 10,000 and 20,000 but it is displaying as 10000 and 20000 resp
I need to add , separator
I saw the sample in
http://demos.telerik.com/aspnet-ajax/chart/examples/programming/addval/defaultcs.aspx
where they are setting the series style to be like
series.DefaultLabelValue = "#Y{N0}";
Can u please guide me how to display my fonts of my requirement
Karthik.K