Hi Aspose team,
It seems we have an issue if I enable “filtered” series (so not visible in the chart) by changing IsFiltered to false, indeed after a full chart calculation the datapoints seems to be empty…
I have a chart with 4 series.
2 are enabled and 2 are disabled:
image.png (46.6 KB)
Via code, I enable the two previous disabled series. (via the FilteredNSeries)
After I am doing a full calculation to get all the datapoints.
As you can see in the logs below, I have no datapoints for Data 2 and scatter2 which were disabled previously and enabled… it is not expected… I need to get the X and Y pixels position…
var pathWorkbook = @"...\\TestHadrienDataLabel.xlsx";
var wbtest = new Workbook(pathWorkbook);
Worksheet sheettest = wbtest.Worksheets[0];
Chart charttest = sheettest.Charts[0];
// Enable the desired series
for (int i = charttest.FilteredNSeries.Count - 1; i >= 0; i--)
{
var series = charttest.FilteredNSeries[i];
if (series.DisplayName == "Data 2" || series.DisplayName == "Scatter 2")
{
series.IsFiltered = false;
}
}
// Create an instance of ChartCalculateOptions
var options = new ChartCalculateOptions
{
UpdateAllPoints = true // Set the property to update all data points
};
charttest.Calculate(options); // calculate all the datapoints for the NSeries
foreach (var series in charttest.NSeries)
{
Console.WriteLine(series.DisplayName);
foreach (ChartPoint point in series.Points)
{
// Do not collect points with negative coordinates. No real values.
if (point.ShapeXPx < 0 || point.ShapeYPx < 0) continue;
// Collect data points
var topLeftX = point.ShapeXPx;
var topLeftY = point.ShapeYPx;
// Print the coordinates
Console.WriteLine($"topLeftX: {topLeftX}, topLeftY: {topLeftY}");
}
}
Result:
**Data 1**
**topLeftX: 131, topLeftY: 337**
**topLeftX: 330, topLeftY: 272**
**topLeftX: 528, topLeftY: 208**
**topLeftX: 727, topLeftY: 144**
*Data 2*
**Scatter 1**
**topLeftX: 131, topLeftY: 144**
*Scatter 2*
Could you have a look please ?
cf the file attached:
TestHadrienDataLabel.zip (12.7 KB)
image.png (33.5 KB)
image.png (12.8 KB)
And if I enable the 2 series manually in excel I have a chart with data:
image.png (20.5 KB)
Thanks for your help,