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

RadChart Issue

8 Answers 73 Views
Documentation and Tutorials
This is a migrated thread and some comments may be shown as answers.
Sumair
Top achievements
Rank 1
Sumair asked on 29 Jan 2014, 12:03 PM

I am using RadChart in Asp.Net

8 Answers, 1 is accepted

Sort by
0
Sumair
Top achievements
Rank 1
answered on 29 Jan 2014, 12:07 PM


Please see this image
0
Danail Vasilev
Telerik team
answered on 31 Jan 2014, 04:13 PM
Hi Sumair,

In order to handle that you can set an appropriate MinValue for the y-axis and/or align series items label on top of the items. For example:
ASPX:
<telerik:RadChart ID="RadChart2" runat="Server" Width="495px" Skin="Mac">
    <ClientSettings EnableZoom="false" ScrollMode="XOnly" XScale="4"></ClientSettings>
    <Series>
        <telerik:ChartSeries DataYColumn="MyColumn" Type="StackedBar">
            <Appearance></Appearance>
            <Appearance FillStyle-MainColor="223, 87, 60">
            </Appearance>
        </telerik:ChartSeries>
        <telerik:ChartSeries DataYColumn="MyColumn" Type="StackedBar">
        </telerik:ChartSeries>
        <telerik:ChartSeries DataYColumn="MyColumn" Type="StackedBar">
        </telerik:ChartSeries>
    </Series>
    <PlotArea>
        <YAxis MinValue="-3" MaxValue="30" AutoScale="false"></YAxis>
    </PlotArea>
    <Legend Visible="false"></Legend>
    <ChartTitle TextBlock-Text="Scrolling only (initial XScale applied)">
    </ChartTitle>
</telerik:RadChart>

C#:
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        DataTable dt = new DataTable();
        dt.Columns.Add(new DataColumn("MyColumn", typeof(int)));
        for (int i = 0; i < 10; i++)
        {
            DataRow dr = dt.NewRow();
            dr[0] = i;
            dt.Rows.Add(dr);
        }
        RadChart2.DataSource = dt;
        RadChart2.DataBind();
    }
}

I can also suggest that you try the newer HtmlChart control that render entirely on the client as SVG and its Data Navigation functionality (see also Zoom and Scroll Data Over Time with RadHtmlChart for ASP.NET AJAX blog post).

More information on the pros and cons of both charts can be found in RadHtmlChart vs. RadChart, round 2. Which one is right for me? blog post. You may also useful Migrating from RadChart to RadHtmlChart
set of articles
that sheds more light on how to migrate the basic chart setup from RadChart to RadHtmlChart.


Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Sumair
Top achievements
Rank 1
answered on 03 Feb 2014, 05:26 AM
Thanks Danail for the response but unfortunately this is not solve my problem. if i set min value equals to minus 3 then i have to describe the maximum value of y-axis which i don't know. I have seen after setting y axis value minus 3 then automatically my y axis max value is around 8 . 
0
Danail Vasilev
Telerik team
answered on 04 Feb 2014, 02:14 PM
Hello Sumair,

I am sorry to say that there is not an easier way to handle that appearance issue. What I can suggest is that you try one of the following approaches:
  • Obtain the Max value from the data source and set it to the y-axis.
  • Keep the AutoScale property of the y-axis to true and just align the series labels on top of the items.
  • Try the newer RadHtmlChart control and its Data Navigation functionality.

Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
Ajay
Top achievements
Rank 2
answered on 21 Feb 2014, 05:12 AM
I want to display my item name instead of yvalue.Currently it's displaying the item value.How can I do that?

<telerik:RadChart ID="RadChart1" runat="server">
<PlotArea>
<XAxis MaxValue="5" MinValue="1" Step="1">
</XAxis>
<YAxis MaxValue="25" Step="5">
</YAxis>
<YAxis2 MaxValue="5" MinValue="1" Step="1">
</YAxis2>
</PlotArea>
<Series>
<telerik:ChartSeries Name="Series 1" Type="Pie">
<Appearance LegendDisplayMode="Nothing" />
<Items>
<telerik:ChartSeriesItem YValue="4" Name="Severe">
</telerik:ChartSeriesItem>
<telerik:ChartSeriesItem YValue="5" Name="Critical">
</telerik:ChartSeriesItem>
<telerik:ChartSeriesItem YValue="12" Name="High">
</telerik:ChartSeriesItem>
<telerik:ChartSeriesItem YValue="8" Name="Moderate">
</telerik:ChartSeriesItem>
<telerik:ChartSeriesItem YValue="1" Name="Complaints Issued">
</telerik:ChartSeriesItem>
</Items>
</telerik:ChartSeries>
</Series>
</telerik:RadChart>
0
Danail Vasilev
Telerik team
answered on 24 Feb 2014, 03:35 PM
Hello Ajay,

You can handle the OnBeforeLayout event where you can assign the series items labels with the series items names. For example:
ASPX:
<telerik:RadChart ID="RadChart1" runat="server" Width="600px" Height="400px" OnBeforeLayout="RadChart1_BeforeLayout">
    <PlotArea>
        <XAxis MaxValue="5" MinValue="1" Step="1">
        </XAxis>
        <YAxis MaxValue="25" Step="5">
        </YAxis>
        <YAxis2 MaxValue="5" MinValue="1" Step="1">
        </YAxis2>
    </PlotArea>
    <Series>
        <telerik:ChartSeries Name="Series 1" Type="Pie">
            <Appearance LegendDisplayMode="Nothing" />
            <Items>
                <telerik:ChartSeriesItem YValue="4" Name="Severe">
                </telerik:ChartSeriesItem>
                <telerik:ChartSeriesItem YValue="5" Name="Critical">
                </telerik:ChartSeriesItem>
                <telerik:ChartSeriesItem YValue="12" Name="High">
                </telerik:ChartSeriesItem>
                <telerik:ChartSeriesItem YValue="8" Name="Moderate">
                </telerik:ChartSeriesItem>
                <telerik:ChartSeriesItem YValue="1" Name="Complaints Issued">
                </telerik:ChartSeriesItem>
            </Items>
        </telerik:ChartSeries>
    </Series>
</telerik:RadChart>

C#:
protected void RadChart1_BeforeLayout(object sender, EventArgs e)
{
    for (int i = 0; i < RadChart1.Series[0].Items.Count; i++)
    {
        RadChart1.Series[0].Items[i].Label.TextBlock.Text = RadChart1.Series[0].Items[i].Name;
    }
}


Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
0
sree
Top achievements
Rank 1
answered on 12 Sep 2015, 10:13 AM

Hi i need help in displaying my radchart.

My datatable looks like below

DataTable dt = new DataTable();
dt.Columns.Add("Country");
dt.Columns.Add("Jan");
dt.Columns.Add("Feb");
dt.Columns.Add("Mar");
dt.Columns.Add("Apr");
dt.Rows.Add("US",134,1657.5,10.8,10);   //for every month i have some amounts associated for country

i am having months as columns and for country wise i am having data for months in currency.

want to display radchart with currency on y-axis for all the months on x-axis using colors for countrywise data

like for "US" want to show red for my bars for every month data similarly for other countries.

my month names should appear on x-axis labels and my country names as legend items.

 

Please help me in achieving this. 

 

0
sree
Top achievements
Rank 1
answered on 12 Sep 2015, 08:57 PM

country  Jan     Feb         mar
US       10.25   130.00   175.24
INDIA   11.00   15.00      160.05

 

country    2013     2014
US           10.25    130
INDIA       11         15

 

the above are the datatables i am getting based on user selection either year or month.

I want to display the amounts in radchart ( bar type ) where my x-axis defaultlabelnames should be monthname or year and legend items should be the country names and individual colors for country bases bars.

 

how to display the above datatable in radchart from codebehind??

 

 

 

 

Tags
Documentation and Tutorials
Asked by
Sumair
Top achievements
Rank 1
Answers by
Sumair
Top achievements
Rank 1
Danail Vasilev
Telerik team
Ajay
Top achievements
Rank 2
sree
Top achievements
Rank 1
Share this question
or