Hi all,
I have a code that reads the file attached and changes the data of the chart. Although the numbers are being updated correctly, the Data Labels are not. Note that the Data Labels make reference to a Cell Range in the data sheet.
Are you able to help?
Thanks.
var stream = new MemoryStream();
using (WordDocument document = new WordDocument(stream, FormatType.Docx))
{
WChart chart = GetChart(document.ChildEntities);
chart.ChartData.SetValue(3, 2, 4);
chart.ChartData.SetValue(4, 2, 2);
chart.ChartData.SetValue(3, 3, "Test YYY");
chart.ChartData.SetValue(4, 3, "Test ZZZ");
// Refreshes chart data to set the modified values
chart.Refresh();
using (FileStream outputFileStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite))
{
// Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
document.Close();
}
}
Hello,
I'm just following up on this, does anyone from support can have a look into this?
Cheers
We have confirmed that the reported issue with “Data labels are not
updated properly when modified the chart data value” is a defect and we
have logged a defect report. We will include the fix for this defect in our
weekly NuGet release, which is estimated to be available on two weeks. We will let you know once
the fix is included in the weekly release.
The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/39111/data-labels-are-not-updated-properly-when-modified-the-chart-data-value
Disclaimer: Inclusion of this solution in the weekly release may change
due to other factors including but not limited to QA checks and works
reprioritization.
Hi Suriya,
Thanks for investigating and reporting the bug to be fixed. Could you also look into the scenario below? The issues might be related.
When the source of values and labels for the charts are a calculated cell, the chart is not refreshed once the source cell changes. The source cell might not triggering a cascade event to update the calculated cell.
I have attached a version of the above spreadsheet with calculated values.
Would you be able to check this scenario too please?
Thanks a mil,
Joao
Attachment: Shared.Calculated_15e8096c.zip
We have confirmed that the reported issue with “Chart
data is not updated properly for the cells containing formula” is a defect
and we have logged a defect report. We will include the fix for this defect in
our weekly NuGet release, which is estimated to be available on two
weeks. We will let you know once the fix is included in the weekly
release.
The status of this bug can be tracked through the below link:
https://www.syncfusion.com/feedback/39275/chart-data-is-not-updated-properly-for-the-cells-containing-formula
Disclaimer: Inclusion of this solution in the weekly release may change
due to other factors including but not limited to QA checks and works
reprioritization.
Regarding - Shared.NotCalculated.docx
- Data labels are not updated properly when modified the chart data value
As promised earlier, we have included the fix
for the reported issue with “Data labels are not updated properly when
modified the chart data value” in our latest weekly NuGet release (v20.3.0.59).
Please use
the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/20.3.0.59
The status
of this bug task can be tracked through the below link:
https://www.syncfusion.com/feedback/39111/data-labels-are-not-updated-properly-while-changing-the-chart-data-values
Note: We will include
this fix in our 2022 Volume 4 Main release which will be available in end of December
2022.
Hi Suriya,
Thanks for getting back to us on this, that's great news.
Do you know if the issue "Chart data is not updated properly for the cells containing formula" is also going to be delivered in this release?
https://www.syncfusion.com/feedback/39275/chart-data-is-not-updated-properly-for-the-cells-containing-formula
Thanks a mil
Regarding - Chart
data is not updated properly for the cells containing formula
We will include the fix for this defect in our next
weekly NuGet release, which is estimated to be available on 6th December
2022.
Disclaimer: Inclusion of this
solution in the weekly release may change due to other factors including but
not limited to QA checks and works reprioritization.
Regarding - Shared.Calculated.docx
- Chart data is not updated properly for the cells
containing formula
As promised earlier, we have included the fix
for the reported issue with “Chart data is not updated properly for the
cells containing formula” in our latest weekly NuGet release (v20.3.0.60).
Please use
the below link to download our latest weekly NuGet:
https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core/20.3.0.60
The status
of this bug task can be tracked through the below link:
https://www.syncfusion.com/feedback/39275/chart-data-is-not-updated-properly-for-the-cells-containing-formula
Note: We will include
this fix in our 2022 Volume 4 Main release which will be available in mid of
December 2022.
Hi Suriya,
Thanks for getting back on it, that's great news!
Unfortunately during my testing the chart did not change based on the calculated fields. I have used the same file previously shared for testing purposes. Would you be able to double check please?
The code looks something like the below:
var stream = new MemoryStream();
using (WordDocument document = new WordDocument(stream, FormatType.Docx))
{
WChart chart = GetChart(document.ChildEntities);
chart.ChartData.SetValue(2, 6, "£");
chart.ChartData.SetValue(7, 6, 2);
// Refreshes chart data to set the modified values
chart.Refresh();
using (FileStream outputFileStream = new FileStream("Result.docx", FileMode.Create, FileAccess.ReadWrite))
{
// Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
document.Close();
}
Attachment: Shared.Calculated_25e5d4be.zip
On further analyzing
the given Word document and code snippet, we have found that the chart data
cells contain formulas and you have changed the dependency cell value of the
chart data. So, the values are not updated properly in the chart.
Unfortunately, we don’t have support to update the formulas cell values based
on dependency cell value. And, we don’t have any plans to implement this
feature.
To resolve the reported issue, we suggest you to change the formulas cell value
directly instead of the dependency cell value of the chart data.