I wanted to find out if you can implement a class for Aspose.Excel that will correspond to the excel chart markers. So, the development can set programmatically the shape of the marker, its color, size, etc. for each chart series separately.
Hi Laurence, I just wanted to tell you a big Thank You, for such a prompt reply and quick resolution of this problem. Everything seams working beautiful. I’m very glad to have a business with such a responsible team of developers and with a helpful, well-design peace of software. Best regards,
Hello Laurence, I am trying to set Markers on a Line/Column chart, excel ver 2.4.x.x.
I can not get the markers to show up. In excel they show as .None.
Here’s the code.
With c1.NSeries(0)
.Type = ChartType.Line
.Line.Color = Color.Red
.Line.Weight = WeightType.HairLine
.Line.Style = LineType.Solid
.MarkerSize = 6
.MarkerStyle = ChartMarkerType.Circle
.MarkerForegroundColor = Color.Red
.MarkerBackgroundColor = Color.Yellow
End With
What do you think I’m missing ? I see posts about using ASeries but I don’t know what the ASeries is and I assume this this code allows me to set these values, then they would work… (above). Just confused if its working and a bug or if its because its not supported yet.
@carbon,
Aspose.Cells has replaced Aspose.Excel which is no more continued and discarded now. Aspose.Cells contains all the features of Aspose.Excel and supports the latest features of MS Excel as well. You can set chart markers using this new products as given in the following sample code:
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Instantiate a workbook
Workbook workbook = new Workbook();
// Access first worksheet
Worksheet worksheet = workbook.Worksheets[0];
// Set columns title
worksheet.Cells[0, 0].Value = "X";
worksheet.Cells[0, 1].Value = "Y";
// Random data shall be used for generating the chart
Random R = new Random();
// Create random data and save in the cells
for (int i = 1; i < 21; i++)
{
worksheet.Cells[i, 0].Value = i;
worksheet.Cells[i, 1].Value = 0.8;
}
for (int i = 21; i < 41; i++)
{
worksheet.Cells[i, 0].Value = i - 20;
worksheet.Cells[i, 1].Value = 0.9;
}
// Add a chart to the worksheet
int idx = worksheet.Charts.Add(ChartType.LineWithDataMarkers, 1, 3, 20, 20);
// Access the newly created chart
Chart chart = worksheet.Charts[idx];
// Set chart style
chart.Style = 3;
// Set autoscaling value to true
chart.AutoScaling = true;
// Set foreground color white
chart.PlotArea.Area.ForegroundColor = Color.White;
// Set Properties of chart title
chart.Title.Text = "Sample Chart";
// Set chart type
chart.Type = ChartType.LineWithDataMarkers;
// Set Properties of categoryaxis title
chart.CategoryAxis.Title.Text = "Units";
//Set Properties of nseries
int s2_idx = chart.NSeries.Add("A2: A2", true);
int s3_idx = chart.NSeries.Add("A22: A22", true);
// Set IsColorVaried to true for varied points color
chart.NSeries.IsColorVaried = true;
// Set properties of background area and series markers
chart.NSeries[s2_idx].Area.Formatting = FormattingType.Custom;
chart.NSeries[s2_idx].Marker.Area.ForegroundColor = Color.Yellow;
chart.NSeries[s2_idx].Marker.Border.IsVisible = false;
// Set X and Y values of series chart
chart.NSeries[s2_idx].XValues = "A2: A21";
chart.NSeries[s2_idx].Values = "B2: B21";
// Set properties of background area and series markers
chart.NSeries[s3_idx].Area.Formatting = FormattingType.Custom;
chart.NSeries[s3_idx].Marker.Area.ForegroundColor = Color.Green;
chart.NSeries[s3_idx].Marker.Border.IsVisible = false;
// Set X and Y values of series chart
chart.NSeries[s3_idx].XValues = "A22: A41";
chart.NSeries[s3_idx].Values = "B22: B41";
// Save the workbook
workbook.Save(@"LineWithDataMarkerChart.xlsx", Aspose.Cells.SaveFormat.Xlsx);
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.