views:

1314

answers:

2

Hey. I am currently developing a .NET application using Visual Studio 2008 and Crystal Reports 12 (2008 Full).

I am binding a custom object that looks like similar to this:

class CustomDataClass
{
   public double Field1;
   public double Field2;
   public double Field3;
   public double Field4;
   public double Field5;
}

Each field will represent it's own line. So in this case there will be 5 lines displayed.

The chart displays the data correctly using the above class however I want to color each series in a specific color. For example Field1 data should be blue. Field2 data should red.

I tried using the Color Highlight tab to achieve this but it did not work. I set it up in the following way:

Value of Field1 between -9999 and 9999 then apply a blue color. I then applied the same rule for the remaining fields.

This did not work well though. The lines were not colored as expected.

Did I set up the chart correctly? Any help would be appreciated.

A: 

As far as I could find there isn't a way to apply custom colors to a line chart conditionally although this worked with bar charts.

The chart will always apply the same colors to each series in the chart in the same order so I used that to create a custom legend. It's a dirty hack but it worked.

Brownman98
A: 

You could generate your chart outside of crystal and the pass it as an image to be displayed in the report.

jvanderh
I've tried this in the paste but the images were always a bit fuzzy. Have you had similar issues before using images?
Brownman98
Yes. You have to determine the size of the image you will generate and then use a sample generated image to add it to crystal in order to have the output size be the same as you are dynamically generating. If not Crystal will resize your image and make a mess out of it.
jvanderh