Currently, the chart is generated considering the format applied to the cells. Thus, when the decimal part is clipped, duplicated values may occur and the developer doesn't have the option to update it:
This is the code:
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets.Add();
List<string> categories = new List<string> { "New", "In Progress", "Ready for Test", "Done", "Declined" };
worksheet.Cells[0, 0].SetValue("New");
worksheet.Cells[0, 1].SetValue(1);
worksheet.Cells[0, 2].SetValue(2.5);
worksheet.Cells[1, 0].SetValue("In Progress");
worksheet.Cells[1, 1].SetValue(2.8);
worksheet.Cells[1, 2].SetValue(0);
worksheet.Cells[2, 0].SetValue("Ready for Test");
worksheet.Cells[2, 1].SetValue(2);
worksheet.Cells[2, 2].SetValue(1);
worksheet.Cells[3, 0].SetValue("Done");
worksheet.Cells[3, 1].SetValue(1.4);
worksheet.Cells[3, 2].SetValue(0);
worksheet.Cells[4, 0].SetValue("Declined");
worksheet.Cells[4, 1].SetValue(3);
worksheet.Cells[4, 2].SetValue(0);
FloatingChartShape chartShape = new FloatingChartShape(worksheet, new CellIndex(5, 5), new CellRange(0, 0, 4, 2),ChartType.Column)
{
Width = 400,
Height = 250
};
worksheet.Charts.Add(chartShape);
CellSelection cellSelection = worksheet.Cells[new CellIndex(0, 1), new CellIndex(4, 2)];
CellValueFormat specialFormat = new CellValueFormat("0");
cellSelection.SetFormat(specialFormat);
string outputFilePath = "SampleFile.xlsx";
Telerik.Windows.Documents.Spreadsheet.FormatProviders.IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();
using (Stream output = new FileStream(outputFilePath, FileMode.Create))
{
formatProvider.Export(workbook, output);
}
Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
The requires options are setting the major/minor units for the axis:
ArgumentNullException is thrown when importing a document containing a rule with no set format.
Add support for creating Tables and applying tables styles (predefined ones or custom).
Error bars in charts you create can help you see margins of error and standard deviations at a glance. They can be shown on all data points or data markers in a data series as a standard error amount, a percentage, or a standard deviation. You can set your own values to display the exact error amounts you want.
Add support for "Invert if negative" property of chart data series fill.
In Excel this can be achieved by right click on the axis, then from the context menu select "Format Axis". Go to the "Text Options" tab and "Text Box" group and then in the "Custom angle" field insert the desired value.
Incorrect calculation of UsedCellRange when conditional formatting is applied to a large cell range.
Workaround:
var usedCellRange = workbook.ActiveWorksheet.GetUsedCellRange(
CellPropertyDefinitions.AllPropertyDefinitions
.Except(
CellPropertyDefinitions.AllPropertyDefinitions.Where(p => p.Name == "DataValidationRule" || p.Name == "ConditionalFormatting")));