I’m current trying to map the ActiveChart.PlotArea to the PlotArea for your component. I don’t see where the ActiveChart.PlotArea.InsideHeight and ActiveChart.PlotArea.InsideWidth maps to any property on the Apose.Cells.PlotArea.
Looking at the picture below, would this describe the chart and plot areas?
What does the PlotArea.X and PlotArea.Y represent?
Would PlotArea.X and PlotArea.Y be the upper left and top most corners of the PlotArea?
-----------------------------------------------
- ChartArea -
- ----------------------------- -
- - - -
- - PlotArea - -
- - - -
- ----------------------------- -
- -
-----------------------------------------------
Hi,
chart area.
Hi,
Hi Pyntia,
hi
the ChartObject Area,plotArea and the ChartArea i don’t understanding very much, exactly i was confuse about these property.
when open excel file, we catch the original property
original property
we find the plotArea size is much bigger than ChartObject’s size, why?
than i change plotArea property, set smaller width and height, the graphic is going so tiny.
change plotArea property
although the plotArea graphic is so small, but the width prop still bigger than ChartObject’s width
my aim is to control the plotArea to accurate position and size. i want to set L1,L2,L3,L4 values like below picture.
plotArea position & size
how can i do it?
the attachment is my test coding and original excel file.
thanks
Hi,
Thanks for your posting and using Aspose.Cells.
Chart area will always be 0 because the entire chart is chart area. Chart area is itself divided as 4000 logical units. So if plot area is 2000 units wide, then it will be half of chart area and if plot area is 3000 units wide, then it will be 3/4 of the chart area.
If you want to get the height and width of the chart shape (not chart area), then use Chart.ChartObject X. Y, Width and Height properties. These properties have nothing to do with plot area.
The following code makes plot area cover the entire chart area.
C#
chart.PlotArea.X = 0;
chart.PlotArea.Y = 0;
chart.PlotArea.Width = 4000;
chart.PlotArea.Height = 4000;
hi, Faiz
Hi,
Thanks for using Aspose.Cells.
I was not able to access your images from the links provided by you. They give me error. However, I found the image inside your rar archive which I have attached with this post for a reference.
L1 is actually Plot Area X property. If PlotArea.X is 100, then it means there is distance of 100 units from the left side of the chart area.
Similarly L4 is PlotArea.Y property. L3 is PlotArea.Height and L2 is PlotArea.Width properties.
hi, Faiz
Hi,
Thanks for your posting and using Aspose.Cells.
Please see the following sample code that makes use of Plot Area X, Y, Width and Height properties and takes images of them. Please also check the source excel file and output images generated with this code. These are 40 images and if you will see them in sequence you will see the X, Y, Width and Height property effects on the chart.
C#
Workbook workbook = new Workbook(“source.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];
Chart chart = worksheet.Charts[0];
chart.Calculate();
int X = chart.PlotArea.X;
int Y = chart.PlotArea.Y;
int W = chart.PlotArea.Width;
int H = chart.PlotArea.Height;
//Now increasing X and taking images
for (int i = 0; i < 10; i++)
{
chart.PlotArea.X += 100;
ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.ImageFormat = ImageFormat.Png;
chart.ToImage(“chart-X” + i + “.png”, opts);
}
//Reset
chart.PlotArea.X = X;
chart.PlotArea.Y = Y;
chart.PlotArea.Width = W;
chart.PlotArea.Height = H;
//Now increasing Y and taking images
for (int i = 0; i < 10; i++)
{
chart.PlotArea.Y += 100;
ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.ImageFormat = ImageFormat.Png;
chart.ToImage(“chart-Y” + i + “.png”, opts);
}
//Reset
chart.PlotArea.X = X;
chart.PlotArea.Y = Y;
chart.PlotArea.Width = W;
chart.PlotArea.Height = H;
//Now increasing Width and taking images
for (int i = 0; i < 10; i++)
{
chart.PlotArea.Width += 100;
ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.ImageFormat = ImageFormat.Png;
chart.ToImage(“chart-Width” + i + “.png”, opts);
}
//Reset
chart.PlotArea.X = X;
chart.PlotArea.Y = Y;
chart.PlotArea.Width = W;
chart.PlotArea.Height = H;
//Now increasing Height and taking images
for (int i = 0; i < 10; i++)
{
chart.PlotArea.Height += 100;
ImageOrPrintOptions opts = new ImageOrPrintOptions();
opts.ImageFormat = ImageFormat.Png;
chart.ToImage(“chart-Height” + i + “.png”, opts);
}