We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change bar colours and chart padding

Couple of questions:

I've set the palette to Default and if I have one bar graph, the bars are a set colour. If I had a couple of line graphs on top, the first line graph takes the colour of the bar graph without the line graphs.

How can I set the bar graph so it is always the same colour whether there are other line graphs on top?

Secondly, is there anyway to reduce the padding between the graph and the image it is generated in (I've highlighted it in gray in the attached image)?

Thanks.

Untitled-1.zip

6 Replies

RF Rashidha F Syncfusion Team May 28, 2007 02:51 PM UTC

Hi Nathan,

Thanks for using Syncfusion Products.

You can able to acehive your requirements using Custom color palette and Element spacing features in chart web control.

Please take a look at the attached sample.

http://websamples.syncfusion.com/samples/Chart.Web/5.1.0.51/I61520/main.htm

Let me know if this helps.

Regards,
Rashidha.


ND Nathan Dunn June 2, 2007 12:09 AM UTC

Hi Rashidha

Thanks for your help. Your suggestion fixed the padding issue I was having.

Please see the attachment, I want the bars in both graphs to be the same colour (the only difference is the second graph also has two line graphs).

Thanks
Nathan

23.zip


RF Rashidha F Syncfusion Team June 2, 2007 06:53 AM UTC

Hi Nathan,

Thanks for your Screen shots.

Please take a look at the attached sample.

http://websamples.syncfusion.com/samples/Chart.Web/5.1.0.51/F61520/main.htm

The above sample shows how to set the custom color for each series.

Please let me know if this helps.

Regards,
Rashidha.


ND Nathan Dunn June 3, 2007 06:10 AM UTC

Hi Rashidha

Still no luck.

Please see the attachment, would like the bars in the background to remain the same colour no matter if they are the only thing in the graph, or if they have one or two lines overlapping.

Does it matter what order they are added to the graph?

Thanks
Nathan

images26.zip


RF Rashidha F Syncfusion Team June 4, 2007 08:40 AM UTC

Hi Nathan,

Thanks for your Information and Screen shots.

When the chart is rendered, the interior color for each series is normally specified by the interior property of the series style. However this is not always the case. In cases where the interior property is left uninitialized, the chart uses its color model to retrieve an array of colors called a palette for this purpose. The ChartColorModel class serves as a repository for color information. Chart series color will vary depending upon the number of series in the chartcontrol.

You can make use of PrepareStyle Event available in chartControl, for your requirement.

The following code snippet illustrates how to set interior color to the series.

protected void ChartControlSeries_PrepareStyle(object sender, ChartPrepareStyleInfoEventArgs args)
{
ChartSeries series = sender as ChartSeries;
if (series != null)
{
args.Style.Interior = new BrushInfo(Color.FromArgb(149, 51, 58));

}
}

Please have a look at the attached sample.

http://websamples.syncfusion.com/samples/Chart.Web/5.1.0.51/F61520_1/main.htm

Please let me know if this helps.

Regards,
Rashdiha.


ND Nathan Dunn June 6, 2007 08:38 AM UTC

Hi Rashdiha

Thanks for all your help, your last suggestion has worked brilliantly.

Regards
Nathan

Loader.
Live Chat Icon For mobile
Up arrow icon