Change marker color on LINE_WITH_DATA_MARKERS chart using Aspose.Cells for Java

I just down loaded 1.5.0.0 and tried a LINE_WITH_DATA_MARKERS chart and I wanted to set my own colors. I was able to set the line color but I am unable to change the marker color.

Also if I try to change the marker size I get the foloowing error when I try to open the xls file in Excel.

"File error: data may have been lost."

I have attached the code that generates the line chart. (Ignore that it is called CreateColumnChart)

To try the marker size problem insert the following line:

aSeries.setMarkerSize(5);

after the line:

aSeries.getBorder().setColor(Color.RED);

Steve Hild
TeamQuest Corp.

I don’t find the attached sample code. Could you please post it again? Thank you very much.

Sorry,

I don't know what happened. Here it is.

Steve

Hi Steve,

Our develpers are all on Labor Day holidays. We will check this issue next Monday as soon as we come back for work.

Thanks Laurence.

Hi,

Please try this fix.

Hi Warren,

This almost works. The only way I can get the background and foreground color of the marker to change is to also change the marker size. In the attached example, I explicitly set both the background and foreground colors on all of the lines but the only ones that actually changed are the ones I set the marker size. I would assume that marker size and color would be independant of each other.

Thanks, Steve

Hi Steve,

Please try this fix.

Hi Warren,

I'm finding all sorts of things when trying to get attributes or set attributes with the LINE_WITH_DATA_MARKERS chart type.

I added some debug code to my original code (see LineChart3.txt) to trace to find out what is happening. I run in JBuilder and I break in this function and step to see the results.

1. I added a case to see what happens if I getMarkerStyle. I get a Diamond shape everytime even though the result isn't a Diamond. I would have assumed that the syle would be AUTOMATIC.

2. If I check to see what the color of the markers background and foreground are before I set them the color is null.

3. If I set the marker background and foreground color they change to a Diamond. If I don't set them it appears it uses Automatic.

4. I also added the following line just before the switch to check for marker type:
aSeries.setMarkerStyle(ChartMarkerType.AUTOMATIC);
And the result become a marker style of NONE. (If I change the colors of the marker then it becomes a square.)

I started down this path of testing because I liked the automatically generated markers but I wanted to define my colors for them.

I couldn't find a way to keep the Automatic markers and have my colors. (Without explicitly set the markers to automatic even though LINE_WITH_DATA_MARKERS started that way.

Thanks for anything you can do.

Steve

Hi Steve,

Please try this fix.

In MS Excel,if you set the marker background color , foreground color or marker size ,the style will be changed to custom when the style is AUTOMATIC .So we couldn't support to keep the Automatic markers and have custom colors.We only can make it similar to MS Excel that which marker style should be used.

If you set the marker to AUTOMATIC, the background and foreground color will be null and they appear they use Automatic (See MS Excel).

The method getMarkerStyle will return AUTOMATIC when the style is AUTOMATIC.

Thanks Warren,

Things seem to work OK in this version.

I assume since the marker setting is automatic then you won't know the actual marker that is assigned since that happens when Excel loads the xls file.

Steve

BTW The default Excel marker size on my machine is 3 pts . I noticed if I getMarkerSize before I set anything it returns 5. (Woudl this be dependant on the display properties?)

Hi Steve,

We really don't know the actual marker that is assigned since that happens when Excel loads the xls file. But the order of assigning the marker style is similar to MS Excel.

The default marker size is associated with border line weight type in MS Excel.

We have fixed the above bug of the default marker size.

Thanks Warren,

You and your team have been great.

Steve