Free Support Forum - aspose.com

****CHART Plot Area set Foregroundcolor moves legend

Hi,

I have some simple code that builds an xyscatter chart and then attempts to change the chart's plot area color at runtime by running the following line of code:

chart.PlotArea.Area.ForegroundColor = Color.Silver;

Whenever this line of code executes it takes the Legend which is originally positioned on the right and then moves it all the way on the top left side of chart. This is very interesting behavior. I have tried resetting the Legend.Position before and after the plotarea color change code and nothing happens. Is there a way around this? Could somone aid me in the correct process to change the plot area color? Any help will be greatly appreciated thanks!!!

Please try this fix.

Thanks Laurence for your quick and hasty response!!!! I downloaded the fix and it solved the legend moving problem!!! I just have one more request for you. On my chart I have total of 9 series, 3 of which are in dashed format the other six are just regular lines. Here is how I format the dashed lines:

chart.NSeries[0].Name = "Level 1 Goal";

chart.NSeries[0].MarkerStyle = ChartMarkerType.None;

chart.NSeries[0].Line.Weight = WeightType.SingleLine;

chart.NSeries[0].Line.Style = LineType.Dash;

chart.NSeries[0].Line.Color = Color.Brown;

chart.NSeries[1].Name = "Level 3 Goal";

chart.NSeries[1].MarkerStyle = ChartMarkerType.None;

chart.NSeries[1].Line.Weight = WeightType.SingleLine;

chart.NSeries[1].Line.Style = LineType.Dash;

chart.NSeries[1].Line.Color = Color.Pink;

chart.NSeries[2].Name = "Level 5 Goal";

chart.NSeries[2].MarkerStyle = ChartMarkerType.None;

chart.NSeries[2].Line.Weight = WeightType.SingleLine;

chart.NSeries[2].Line.Style = LineType.Dash;

chart.NSeries[2].Line.Color = Color.Yellow;

It looks like it doesn't pick up the colors that I set on the dashed lines. It picks up the yellow... on the chart.NSeries[2] series but the first two don't pick up(This is wierd as well....I have another series in the other six with yellow...it seems any color that I put in that is on the other 6 lines that aren't dashed it picks them up). The colors were working before when they were solid, not dashed so I went back and tried to reverse the linestyle to solid but that didn't change anything. I don't know if it is the new aspose.excel.dll with the fix in it or what. If you could kindly check on this for me that would be great!!!.......I will be finished!!!!