Hi! Team,
I want to display Series for different values with gradient support I have attached the snippet code & the screenshot of what I want to achieve as part of excel.
I have added manually created excel with gradient for one of the Series values.
But how I can do it programmatically.
Please let me know if you want further details.
Hi! @Amjad_Sahi
thanks for the quick response but I want to apply the gradient to a single bar in the chart, not for the whole series. Is it possible to do so? In excel we can manually do that.
But how I can do it programmatically.
thanks!
You will set gradient color to your desired series point. See the following lines of code:
e.g. Sample code:
//Get the first data point of the first series
ChartPoint point = serieses.get(0).getPoints().get(0);
//Set gradient fill color and other effects
point.getArea().getFillFormat().setFillType(FillType.GRADIENT);
point.getArea().getFillFormat().setTwoColorGradient(com.aspose.cells.Color.getGreen(), com.aspose.cells.Color.getWhite(), GradientStyleType.HORIZONTAL, 2);
point.getArea().getFillFormat().getGradientFill().setGradient(GradientFillType.LINEAR, 90, GradientDirectionType.FROM_CENTER);
Hi! @Amjad_Sahi
Thanks! It works. really! grateful.
Can you help me with PATTERN as well?
I have attached the image in the chat. I want to apply Patterns for some ChartPoint.
How can I add color & change the PATTERN to this.image.png (127.6 KB)
See the following lines of code for your reference:
e.g. Sample code:
//Get the first data point of the first series
ChartPoint point = serieses.get(0).getPoints().get(0);
//Set Pattern fill colors and effects
point.getArea().getFillFormat().setFillType(FillType.PATTERN);
point.getArea().setForegroundColor(com.aspose.cells.Color.getDarkBlue());
point.getArea().setBackgroundColor(com.aspose.cells.Color.getLightBlue());
point.getArea().getFillFormat().setPattern(FillPattern.WIDE_UPWARD_DIAGONAL);