We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with Chart type : Line with data marker

Hi All,

I want to generate a chart with chart type Line with data marker . The chart is getting generated but the problem is on chart one area Data table is coming. I dont want this data table on my chart.

I tried chart.IsDataTableShown = false; property but still data table is coming.

can anyone suggest what is the correct property for not showing data table on Chart.

Please provide code.

I am using excel 2007.

Thanks,

Hi Jack,

Following code snippet will help. On the other hand, The property : chart.IsDataTableShown is now obsolete. Please use Chart.ShowDataTable property to Gets or Sets a value indicating whether the chart displays a data table.

Code snippet:
//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];

//Adding a sample value to "A1" cell
worksheet.Cells["A1"].PutValue(50);

//Adding a sample value to "A2" cell
worksheet.Cells["A2"].PutValue(100);

//Adding a sample value to "A3" cell
worksheet.Cells["A3"].PutValue(150);

//Adding a sample value to "B1" cell
worksheet.Cells["B1"].PutValue(60);

//Adding a sample value to "B2" cell
worksheet.Cells["B2"].PutValue(32);

//Adding a sample value to "B3" cell
worksheet.Cells["B3"].PutValue(50);

//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(ChartType.Column, 5, 0, 25, 10);

//Accessing the instance of the newly added chart
Chart chart = worksheet.Charts[chartIndex];

//Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B3"
chart.NSeries.Add("A1:B3", true);

chart.IsDataTableShown = false;

//Getting Chart Table
ChartDataTable chartTable = chart.ChartDataTable;

//Setting Chart Table Font Color
chartTable.Font.Color = System.Drawing.Color.Red;

//Setting Legend Key Visibility
chartTable.ShowLegendKey = false;

//Saving the Excel file
workbook.Save("D:\\book1.xls");

Thanks

Hi,

I am using Aspose 4.9.1.0 Version.

There is No such property as you told in the reponse.

i.e. Chart.Showdatatable

Please advise me what to do as it is somewhat urgent.

Please help me out..

Thanks,

Hi,

Since you are using some older version e.g v4.9.1.0 for which we are not sure about it.
I have tried the following sample code with the latest version (attached: v5.1.3.1), it works fine.

//Instantiating a Workbook object
Workbook workbook = new Workbook();

//Obtaining the reference of the first worksheet
Worksheet worksheet = workbook.Worksheets[0];

//Adding a sample value to “A1” cell
worksheet.Cells[“A1”].PutValue(50);

//Adding a sample value to “A2” cell
worksheet.Cells[“A2”].PutValue(100);

//Adding a sample value to “A3” cell
worksheet.Cells[“A3”].PutValue(150);

//Adding a sample value to “B1” cell
worksheet.Cells[“B1”].PutValue(60);

//Adding a sample value to “B2” cell
worksheet.Cells[“B2”].PutValue(32);

//Adding a sample value to “B3” cell
worksheet.Cells[“B3”].PutValue(50);

//Adding a chart to the worksheet
int chartIndex = worksheet.Charts.Add(ChartType.LineWithDataMarkers, 5, 0, 25, 10);

//Accessing the instance of the newly added chart
Chart chart = worksheet.Charts[chartIndex];

//Adding NSeries (chart data source) to the chart ranging from “A1” cell to “B3”
chart.NSeries.Add(“A1:B3”, true);

chart.ShowDataTable = false;

//Getting Chart Table
ChartDataTable chartTable = chart.ChartDataTable;

//Setting Chart Table Font Color
chartTable.Font.Color = System.Drawing.Color.Red;

//Saving the Excel file
workbook.Save(“e:\test\outputBook.xls”);

Please try the attached version. If you still find the issue, kindly do post your sample code (same as mine) with template file(s), we will check your issue soon.

Thank you.

Hi ,

Thanks for your response..

I have attached the report and pasted the code.

Please on report.. i mean on chart there is one data table .. please let me know how to remove that data table through coding.

the code id as follows:

private void createConversionChart(Worksheet chartsheet, String parentSplitName, String NSeries1, String Nseries2, String category)
{
try
{
chartsheet.IsGridlinesVisible = false;

int chartIndex = chartsheet.Charts.Add(ChartType.LineWithDataMarkers, 0, 0, 28, 12);
Chart chart = chartsheet.Charts[chartIndex];

//Chart options
// chart.IsDataTableShown = false;
//ChartDataTable cdt = chart.ChartDataTable;
//cdt.ShowLegendKey = false;

chart.ChartDataTable.ShowLegendKey = false;
chart.IsDataTableShown = false;

//chart.MajorGridLines.IsVisible = true;
// chart.SeriesAxis.IsVisible = false;

//chart.ChartObject.Chart.IsDataTableShown = false;
//chart.CategoryAxis.AxisBetweenCategories = false;

chart.NSeries.Add(Nseries2, true);
chart.NSeries[0].XValues = category;

//Legend
chart.IsLegendShown = true;
chart.Legend.TextFont.Name = "Calibri (Body)";
chart.Legend.TextFont.Size = 8;
chart.Legend.Background = BackgroundMode.Transparent;
chart.Legend.Position = LegendPositionType.Bottom;
chart.Legend.TextFont.Color = System.Drawing.Color.Black;
chart.Legend.Border.IsVisible = false;

chart.Title.Text = "Volume Distribution Report";
chart.Title.TextFont.Name = "Calibri (Body)";
chart.Title.TextFont.IsBold = true;
chart.Title.TextFont.Size = 10;
chart.ChartArea.Background = BackgroundMode.Transparent;
chart.ChartArea.Border.IsVisible = true;
chart.ChartArea.Border.Weight = WeightType.HairLine;
chart.ChartArea.Border.Style = LineType.Solid;

chart.PlotArea.Border.IsVisible = false;
chart.PlotArea.Border.Style = LineType.Solid;
//chart.PlotArea.Border.Weight = WeightType.HairLine;
//chart.PlotArea.Border.Color = System.Drawing.Color.Gray;
//chart.PlotArea.Area.BackgroundColor = System.Drawing.Color.White;
//chart.PlotArea.Background = BackgroundMode.Transparent;
//chart.PlotArea.Area.ForegroundColor = System.Drawing.Color.Transparent;
//chart.ChartArea.Area.BackgroundColor = System.Drawing.Color.White;

////Category Axis - X
chart.CategoryAxis.IsVisible = true;
chart.CategoryAxis.AxisLine.Style = LineType.Solid;
chart.CategoryAxis.AxisLine.Weight = WeightType.HairLine;
chart.CategoryAxis.AxisLine.Color = System.Drawing.Color.Black;
chart.CategoryAxis.MajorTickMark = TickMarkType.None;
chart.CategoryAxis.MinorTickMark = TickMarkType.Outside;
chart.CategoryAxis.CrossAt = 1;
chart.CategoryAxis.Title.TextFont.Size = 6;
chart.CategoryAxis.TickLabels.Font.Size = 6;
chart.ValueAxis.MinorGridLines.IsVisible = true;
chart.ValueAxis.MinorGridLines.Weight = WeightType.HairLine;
// chart.ValueAxis.MinorGridLines.Color = System.Drawing.Color.FromArgb(183, 183, 183);
chart.CategoryAxis.TickLabels.Rotation = 57;

// ////ASERIES

ASeries Series1 = chart.NSeries[0];
Series1.Name = "PREAPPROVED";
Series1.Line.Weight = WeightType.SingleLine ;
Series1.MarkerStyle = ChartMarkerType.None;
Series1.MarkerSize = 8;
Series1.MarkerForegroundColor = System.Drawing.Color.Blue;
Series1.Line.Color = System.Drawing.Color.FromArgb(79, 129, 189);
Series1.MarkerBackgroundColor = System.Drawing.Color.Transparent;

ASeries Series2 = chart.NSeries[1];
Series2.Name = "BROADMEDIA";
Series2.Line.Weight = WeightType.SingleLine;
Series2.MarkerStyle = ChartMarkerType.None;
Series2.MarkerSize = 8;
Series2.Line.Color = System.Drawing.Color.Red;
Series2.MarkerForegroundColor = System.Drawing.Color.Red;
Series2.MarkerBackgroundColor = System.Drawing.Color.Transparent;


ASeries Series3 = chart.NSeries[2];
Series3.Name = "ITA";
Series3.Line.Weight = WeightType.SingleLine;
Series3.MarkerStyle = ChartMarkerType.None;
Series3.MarkerSize = 8;
Series3.Line.Color = System.Drawing.Color.YellowGreen;
Series3.MarkerForegroundColor = System.Drawing.Color.YellowGreen;
Series3.MarkerBackgroundColor = System.Drawing.Color.Transparent;


ASeries Series4 = chart.NSeries[3];
Series4.Name = "PHONE/TRANSFER";
Series4.Line.Weight = WeightType.SingleLine;
Series4.MarkerStyle = ChartMarkerType.None;
Series4.MarkerSize = 8;
Series4.Line.Color = System.Drawing.Color.Green;
Series4.MarkerForegroundColor = System.Drawing.Color.Green;
Series4.MarkerBackgroundColor = System.Drawing.Color.Transparent;


ASeries Series5 = chart.NSeries[4];
Series5.Name = "INTERNET";
Series5.Line.Weight = WeightType.SingleLine;
Series5.MarkerStyle = ChartMarkerType.None;
Series5.MarkerSize = 8;
Series5.Line.Color = System.Drawing.Color.Purple;
Series5.MarkerForegroundColor = System.Drawing.Color.Purple;
Series5.MarkerBackgroundColor = System.Drawing.Color.Transparent;

chart.Placement = PlacementType.MoveAndSize;
}
catch (Exception e)
{
throw e;
}
}

Hi,

After an initial test using your template file, I have found the issue, we will figure it out soon.

I have logged your issue into our issue tracking system with an id: CELLSNET-20364.

We also noticed the issue happens only for XLSX files.

Thank you.

Hi,

Have you got the Solution for my question.

Please reply..

Thanks,

Hi,

Hopefully, we can provide a fix within 1-3 days.

Thank you.

Hi,

We have fixed the issue, kindly try the attached version.

Thank you.

The issues you have found earlier (filed as 20364) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.