I want to apply gradient feature to different values of the Series

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.

thanks!

GradientSupport.png (66.2 KB)
HowToCreateCustomChart.zip (1.8 KB)

@Rohan_Wankar,

See the following sample code for your reference. It sets gradient fill color for the first data series of the chart.
e.g.
Sample code:

.......
SeriesCollection serieses = chart.getNSeries();
serieses.get(0).getArea().getFillFormat().setFillType(FillType.GRADIENT);
serieses.get(0).getArea().getFillFormat().setTwoColorGradient(com.aspose.cells.Color.getGreen(), com.aspose.cells.Color.getWhite(), GradientStyleType.HORIZONTAL, 2);

serieses.get(0).getArea().getFillFormat().getGradientFill().setGradient(GradientFillType.LINEAR, 90, GradientDirectionType.FROM_CENTER);
.......

Hope, this helps a bit.

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!

@Rohan_Wankar,

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);

Hope, this helps a bit.

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)

@Rohan_Wankar,

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);

Hope, this helps a bit.