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

Changing point chart properties

5 Answers 270 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Billy8988
Top achievements
Rank 1
Billy8988 asked on 15 Jul 2008, 02:07 PM
I am trying to change point size, color, and the shape.

Here is my code.

ChartSeries s = RadChart2.GetSeries(0);
s.Appearance.ShowLabels =
false;
s.Appearance.PointMark.Dimensions.AutoSize =
false;
s.Appearance.PointMark.FillStyle.MainColor =
Color.Red;
s.Appearance.PointMark.FillStyle.SecondColor =
Color.White;
s.Appearance.PointMark.Dimensions.Height = 2;
s.Appearance.PointMark.Dimensions.Width = 2;
s.Appearance.PointMark.Visible =
true;
s.Appearance.PointDimentions.Height = 2;
s.Appearance.PointDimentions.Width = 2;
s.Appearance.PointDimentions.AutoSize =
false;
s.Appearance.FillStyle.MainColor =
Color.Red;
s.Appearance.FillStyle.SecondColor =
Color.White;
s.Appearance.PointShape =
"Diamond";
s.Appearance.PointMark.Figure =
"Diamond";

Size is changed but the color and shape of points will not change.
As you can see, I am setting everything I can think of to see if it will work.
Any help would be greatly appreciated.

BTW, why would you ask us to set the figure property as string?
What happened to enum?

Thanks.

- MK

5 Answers, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 16 Jul 2008, 01:28 PM
Hello Murugan Kannan,

If you are trying to change the color only for the point marks (Line chart), it could be done like this:

s.Appearance.ShowLabels = false
s.Appearance.PointMark.Dimensions.AutoSize = false
s.Appearance.PointMark.FillStyle.MainColor = Color.Red; 
s.Appearance.PointMark.FillStyle.SecondColor = Color.White; 
s.Appearance.PointMark.Dimensions.Height = 10
s.Appearance.PointMark.Dimensions.Width = 10
s.Appearance.PointMark.Visible = true
 
s.Appearance.PointMark.FillStyle.MainColor = Color.Red; 
s.Appearance.PointMark.FillStyle.SecondColor = Color.White; 
s.Appearance.PointMark.Figure = Telerik.Charting.Styles.DefaultFigures.Diamond; 


If you are trying to change the color for the points in a Point chart, it could be achieved like this:
s.Appearance.PointShape = Telerik.Charting.Styles.DefaultFigures.Diamond; 
s.Appearance.FillStyle.MainColor = Color.Red; 
s.Appearance.FillStyle.SecondColor = Color.White; 
s.Appearance.PointDimentions.Height = 10
s.Appearance.PointDimentions.Width = 10
s.Appearance.PointDimentions.AutoSize = false


As for the enum -- it is still present (Telerik.Charting.Styles.DefaultFigures) but there is option to set the property as plain string in order to provide support for custom user-defined figures.


All the best,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Billy8988
Top achievements
Rank 1
answered on 16 Jul 2008, 07:29 PM
Thanks Manuel.

I want to change properties of the points in a point chart.
I followed your 2nd option but I am still getting the same default color points (blue). It changed the shape to "+" even though I am setting it to "Diamond".

BTW, it changed the legend to red and white but not the actual points on the point chart.

Here is my code example

SqlCommand cmd = new SqlCommand("SELECT FLOW FROM FLOW_MONITORING WHERE FLOW_MONITOR_ID = 2 AND TIMESTAMP >= '03/20/2008' AND TIMESTAMP <= '03/30/2008'", conn);

SqlDataReader rd = cmd.ExecuteReader();
RadChart2.DataSource = rd;
RadChart2.DataBind();

ChartSeries

s = RadChart2.GetSeries(0);
s.Appearance.ShowLabels = false;
s.Appearance.PointShape = Telerik.Charting.Styles.
DefaultFigures.Diamond;
s.Appearance.FillStyle.MainColor =
Color.Red;
s.Appearance.FillStyle.SecondColor =
Color.White;
s.Appearance.PointDimentions.Height = 2;
s.Appearance.PointDimentions.Width = 2;
s.Appearance.PointDimentions.AutoSize =
false;

Thanks again for your help.

-MK

0
Accepted
Giuseppe
Telerik team
answered on 17 Jul 2008, 08:40 AM
Hi Murugan Kannan,

If your point size is very small, you might need to turn off the border in order to see the color applied like this: s.Appearance.Border.Visible = false;

Attached is a runnable sample application as well.


Regards,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
manoj
Top achievements
Rank 1
answered on 10 Jan 2011, 11:06 AM
Hi!
When I use :-
S.Appearance.PointShape = Telerik.Charting.Styles.DefaultFigures.Triangle;
it is change only chart but i want to change also lable like attement.
and also arreng the leble size.


Thanks
--------

 

0
Giuseppe
Telerik team
answered on 12 Jan 2011, 06:34 PM
Hello Manoj,

You can achieve the desired effect like this:

ASPX
<telerik:RadChart ID="RadChart1" runat="Server" AutoLayout="true" AutoTextWrap="true">
    <Series>
        <telerik:ChartSeries Type="Point" Name="National Average">
            <Appearance PointShape="Triangle" />
            <Items>
                <telerik:ChartSeriesItem YValue="21" />
                <telerik:ChartSeriesItem YValue="11" />
                <telerik:ChartSeriesItem YValue="15" />
            </Items>
        </telerik:ChartSeries>
        <telerik:ChartSeries Type="Point" Name="National Average 2">
            <Items>
                <telerik:ChartSeriesItem YValue="31" />
                <telerik:ChartSeriesItem YValue="41" />
                <telerik:ChartSeriesItem YValue="55" />
            </Items>
        </telerik:ChartSeries>
    </Series>
</telerik:RadChart>

C#
protected void Page_Load(object sender, EventArgs e)
{
    RadChart1.BeforeLayout += new EventHandler<EventArgs>(RadChart1_BeforeLayout);
}
 
void RadChart1_BeforeLayout(object sender, EventArgs e)
{
    RadChart1.Legend.Items[0].Marker.Appearance.Figure = DefaultFigures.Triangle;
}



Greetings,
Freddie
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Chart (Obsolete)
Asked by
Billy8988
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Billy8988
Top achievements
Rank 1
manoj
Top achievements
Rank 1
Share this question
or