Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Chart > Help in chart
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Help in chart

Feed from this thread
  • Karthik Kantharaj Intermediate avatar

    Posted on Mar 15, 2011 (permalink)

    Hi Guys

    I am working on chart where i have different currency
    i am displaying different value for different currency
    is there any way to differentiate the currency value displayed in chart

    If you people have any idea please guide me

    Karthik.K

  • Vladimir Milev Vladimir Milev admin's avatar

    Posted on Mar 18, 2011 (permalink)

    Hi Karthik Kantharaj,

    The currency displayed depends on the culture settings of your application. If you change its current culture the chart control will respect that and will format currency according to the new culture.

    All the best,
    Vladimir Milev
    the Telerik team

  • Karthik Kantharaj Intermediate avatar

    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   


  • Vladimir Milev Vladimir Milev admin's avatar

    Posted on Mar 25, 2011 (permalink)

    Hi Karthik Kantharaj,

    You should use the format string "#Y{#,#}" for ItemLabel format.

    Kind regards,
    Vladimir Milev
    the Telerik team

  • Karthik Kantharaj Intermediate avatar

    Posted on Mar 26, 2011 (permalink)

    Hi Vladimir Milev

    Thank you
    I am not sure whether i am right or wrong (Please coorect me)

    Please see my code i thing  ItemLabel format used in series tag (As i saw in other samples) i am not using any series

    Can you please correct me if i am wrong
    So where i need to use ItemLabel format (In my code)

    If you can correct me with my code it will be more helpful

    Karthik.K

  • Vladimir Milev Vladimir Milev admin's avatar

    Posted on Mar 30, 2011 (permalink)

    Hi Karthik Kantharaj,

    series.DefaultLabelValue = "#Y{N0}"; -------> #Y{#,#}

    All the best,
    Vladimir Milev
    the Telerik team

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Chart > Help in chart