Sum of requests

Hi Laurence,

I have to resume about some features:

1. chart.NSeries[i].Line.Weight = WeightType.MediumLine;
a) The line get colored black though color before was red or some other color
b) The DataMarkers appears though I’m using “ChartType.Line” and not “ChartType.LineWithDataMarkers”.
c) The DataMarkers get colored pink though “chart.NSeries[i].Line.Color = Color.Red;” -> Either DataMarkers in color of line [by ChartType=LineWithDataMarkers] or invisible or a method / variable to color manual.

2. Reading conditional formatting from designerfile for formulafields in generated sheets.

For these features I need to know a timeline within it will be fixed. I have to give out this timeline, so please call a date which is real.

Regards, Stefan

Hi Stefan,

About 1, it’s fixed in the latest hotfix.

Please download it and have a try.

About 2, this feature is far complex than I had thought before, so I have to delay to the mid of June.

Hi Laurence,

I tested new release at the moment but still getting not the output I need.

I refer to my post of yesterday

1a)
My charttype is ChartType.Line. I have written following code:
for(int i = 0; i < chart.NSeries.Count; i ++)
{
chart.NSeries[i].Line.Weight = WeightType.MediumLine;
}
All lines get the color black! So I can’t differ with my legend which line is for which data.
If I set NO Line.Weight, the lines get automatic a color assigned. This “autocolor” feature get’s lost by setting Line.Weight!

1b)
fixed

1c)
My charttype is ChartType.LineWithDataMarkers. I’m using follwing code:
chart.NSeries[1].Line.Color = Color.Red;
The line gets the color red but the “DataMarkers” have color pink (pink is this line when not setting explicit a color = autocolor). I want to have the DataMarkers in same color as the line.

2)
Conditional formatting: Can Aspose.Excel set conditional formatting by code? I mean, can I write cell.ConditionalStyle.Font.Color = Color.Red ?
The question for my example is just, which value is for the conditional format because of no formula is deposited.
For me it would reach to set cellstyle for negative formula results, so if this can be easier included you can think about it if nobody else need this feature…

Thanks for support!!!

Regards, Stefan


Please have I try on your machine. I use WinXP Pro & Excel XP. FileFormatType.Default.


Hi Stefan,

1a) Yes. Currently after setting the width, all line color is set to black by default. You can set the line color by your own code.

1c) I will check this again.

2) We will supply code to set conditionla formatting. But it’s far more complex than your suggested code. You can refer to MS Excel VBA help for conditional formatting issue.

Hi Laurence,

the conditionla formatting takes some time, OK!

But 1a) is not dissatisfying for me.
Can you please add the feature “autocolor” also by setting Line.Weight? This is because of I don’t know how many rows and thus lines I will get in my excel-sheets / diagramms and hold about 20 or 30 colors for it is not very fine.

Regards, Stefan

Hi Stefan,

About 1a, you are right. It’s very inconvennence to set so many colors. Could you give me one or two days to investigate this issue?

Hi Laurence,

investigate this prob and solve it and I’m happy!
End of week is soon enough…

-Stefan

Hi Stefan,

1A is fixed. Please download hotfix 1.9.4 and have a try.

Hi Laurence,

1a) is fixed, your right!
1a add-on) In ChartType.LineWithDataMarkers this functionality is not included yet. If you fix the DataMarkers.Color to Line.Color (1c) problem, please add feature of 1a) into ChartType.LineWithDataMarkers.

Thanks for your quick support!!!

-Stefan

@WebJumper,
Just for you information that Aspose.Excel is discontinued and replaced by Aspose.Cells. There is no more development done for Aspose.Excel now. The new product Aspose.Cells supports old as well as new versions of MS Excel. You can create line with data marker chart using this product also as shown in the following sample code:

// 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(outputDir + @"LineWithDataMarkerChart.xlsx", Aspose.Cells.SaveFormat.Xlsx);

Here is the link to a detailed section where information is available for different type of charts:
Charts

Here is a link where you can get the free trial version for testing:
Aspose.Cells for .NET (Latest Version)

You can download the complete runnable solution for teting here.