Free Support Forum - aspose.com

******** NEED IMMEDIATE ATTENTION******** Need compatible properties for MSO chart /Native Chart which are available in OLE chart ******** URGENT *******

Hi -

We are actually migrating our project that have been developed for OLE chart object to MSO chart/Native Chart object. We are not able to findout suitable properties for MSO/Native which are available in OLE.Please help us and let us know whether the listed functionalities are available in MSO/Native or not, if available, guide us to where (class/function/property) exactly are these available.

OLE Chart Properties that we are currently using for

1) ShowHideLegendBorder

Aspose.Cells.Charts.Legend legend = chart.Legend;

legend.Border.IsVisible = false;

2) SetLegendBorder

Aspose.Cells.Charts.Legend legend = chart.Legend;
Aspose.Cells.Drawing.LineType borderLine = Aspose.Cells.Drawing.LineType.DarkGray;

System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(lineColor);
legend.Border.Color = color;
legend.Border.Style = borderLine;

3) SetLegendFontStyle

Aspose.Cells.Charts.Legend legend = chart.Legend;
System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml(fontColor);
legend.Font.Color = color;
legend.Font.Name = fontFamily;
legend.Font.IsItalic = Boolean.Parse(isItalic);
legend.Font.IsBold = Boolean.Parse(isBold);

4) SetLegendMarker


SeriesCollection sCollection = chart.NSeries;
sSeries.Marker.MarkerStyle = ChartMarkerType.Automatic;

5) Aspose.Cells.Charts.Axis axis = chart.CategoryAxis;

AxisTitleOrientation:

axis.Title.RotationAngle = Int32.Parse(angle);

6) SetAxisTitleFontStyle:

axis.Title.Font.Name = fontFamily;
axis.Title.Font.DoubleSize = double.Parse(fontSize);
axis.Title.Font.IsItalic = Boolean.Parse(isItalic);
axis.Title.Font.IsBold = Boolean.Parse(isBold);

7) SetAxisLabelStyle:

axis.TickLabels.Font.Color = color;
axis.TickLabels.Font.Name = fontFamily;
axis.TickLabels.Font.DoubleSize = double.Parse(fontSize);
axis.TickLabels.Font.IsItalic = Boolean.Parse(isItalic);
axis.TickLabels.Font.IsBold = Boolean.Parse(isBold);

For OLE Chart , we are using Aspose.Cells.Charts.Chart

Refer Attached Example for OLE charts :OLE Chart.pptx

For MSO Chart (Micorosoft Office Charts), we are using Aspose.Slides.Pptx.ChartEx

Refer Attached Example for MSO charts : MSOChart_NativeChart.pptx

Hi Venkat,


Thanks for inquiring Aspose.Slides.

I have observed all of your requirements and like to share that Aspose.Slides fulfills all the requirements shared by you except one with setting angle of rotation for category axis text. An issue with ID SLIDESNET-33799 has already been added to provide this feature and we will notify you once the feature will be available.

For rest of your requirements, please use the sample code below. I have shared an extensive sample code encompassing your listed requirements along with many other chart formatting features. I also like to add the chart markers are set for series and they are managed in series using Aspose.Slides as against setting them in Legends using Aspose.Cells.

public static void MangeLineChartProperties()
{
MemoryStream ms = new MemoryStream();
ms.Position = 0;
PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.LineWithMarkers, 50, 50, 500, 400);


//Setting Major and minor grid lines format for value axis
chart.ValueAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.ValueAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Blue;
chart.ValueAxis.MajorGridLines.Width = 5;

chart.ValueAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.ValueAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Red;
chart.ValueAxis.MinorGridLines.Width = 3;

chart.ValueAxis.SourceLinked = false;
//chart.ValueAxis.DisplayUnit = DisplayUnitType.Millions;
chart.ValueAxis.DisplayUnit = DisplayUnitType.Thousands;
chart.ValueAxis.NumberFormat = “0.0%”;

//Setting chart maximum, minimum values
chart.ValueAxis.IsAutomaticMajorUnit = false;
chart.ValueAxis.IsAutomaticMaxValue = false;
chart.ValueAxis.IsAutomaticMinorUnit = false;
chart.ValueAxis.IsAutomaticMinValue = false;
chart.ValueAxis.MaxValue = 15f;
chart.ValueAxis.MinValue = -2f;
chart.ValueAxis.MinorUnit = 0.5f;
chart.ValueAxis.MajorUnit = 2.0f;


//Setting Major and minor grid lines format for Category axis
chart.CategoryAxis.MajorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.CategoryAxis.MajorGridLines.FillFormat.SolidFillColor.Color = Color.Green;
chart.CategoryAxis.MajorGridLines.Width = 5;
chart.CategoryAxis.MinorGridLines.FillFormat.FillType = FillTypeEx.Solid;
chart.CategoryAxis.MinorGridLines.FillFormat.SolidFillColor.Color = Color.Yellow;
chart.CategoryAxis.MinorGridLines.Width = 3;


//Setting Category Axis Text Properties
TextFrameEx txt = chart.CategoryAxis.TextProperties;

txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;
txt.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;

//Setting Value Axis Text Properties
TextFrameEx txt2 = chart.ValueAxis.TextProperties;

txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;
txt2.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;


//Setting Value Axis title
//Setting Axis Title
TextFrameEx title = chart.ValueAxis.Title.Text;
ParagraphEx text = new ParagraphEx();
text.Text = “Mudassir Fayyaz”;
text.Portions[0].PortionFormat.FontHeight = 20;
text.Portions[0].PortionFormat.FillFormat.FillType = FillTypeEx.Solid;
text.Portions[0].PortionFormat.FillFormat.SolidFillColor.Color = Color.Green;
title.Paragraphs.Add(text);
chart.ValueAxis.HasTitle = true;


//Setting Legends Text Properties

TextFrameEx txt3 = chart.Legend.TextProperties;
txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;
txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid; ;
txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.Blue;
//Set the Font for the Portion
txt3.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.LatinFont = new FontDataEx(“Times New Roman”);
chart.ValueAxis.AxisLine.Width = 10;
chart.ValueAxis.AxisLine.FillFormat.FillType = FillTypeEx.Solid;
chart.ValueAxis.AxisLine.FillFormat.SolidFillColor.Color = Color.Red;
//Setting Legend border
LegendEx legend = chart.Legend;
legend.Format.Line.FillFormat.FillType = FillTypeEx.Solid;
legend.Format.Line.FillFormat.SolidFillColor.Color = Color.Red;
legend.Format.Line.Style = LineStyleEx.ThickThin;
legend.Format.Line.Width = 5;
legend.Format.Line.DashStyle = LineDashStyleEx.DashDot;


chart.SecondValueAxis.IsVisible = true;
chart.SecondValueAxis.AxisLine.Style = LineStyleEx.ThickBetweenThin;
chart.SecondValueAxis.AxisLine.Width = 20;


//Setting chart back wall color
chart.ChartFormat.Fill.FillType = FillTypeEx.Solid;
chart.ChartFormat.Fill.SolidFillColor.Color = Color.Orange;

//Setting Plot area color
chart.PlotArea.Format.Fill.FillType = FillTypeEx.Solid;
chart.PlotArea.Format.Fill.SolidFillColor.Color = Color.LightCyan;

//working with chart series
ChartSeriesEx series = chart.ChartData.Series[0];


//Setting series marker and its properties for series
series.MarkerSymbol = MarkerStyleTypeEx.Diamond;
series.MarkerSize = 20;
series.MarkerFill.Fill.FillType = FillTypeEx.Solid;
series.MarkerFill.Fill.SolidFillColor.Color = Color.RosyBrown;
series.MarkerFill.Line.Width= 2;
series.MarkerFill.Line.FillFormat.FillType=FillTypeEx.Solid;
series.MarkerFill.Line.FillFormat.SolidFillColor.Color = Color.Chocolate;

//Setting Line format for chart series
series.Format.Line.DashStyle = LineDashStyleEx.Dot;
series.Format.Line.Style = LineStyleEx.ThickThin;
series.Format.Line.Width = 5d;
series.Format.Fill.FillType = FillTypeEx.Solid;
series.Format.Fill.SolidFillColor.Color = Color.Black;

//Plotting series on secondary axis
series.PlotOnSecondAxis = true;

//Adding Series label and its properties
DataLabelEx label = new DataLabelEx(series);
series.Labels.Add(label);
series.Labels.ShowValue = true;
series.Labels.ShowSeriesName = false;
series.Labels.ShowCategoryName = false;
series.Labels.LinkedSource = false;
series.Labels.NumberFormat = “0.0%”;
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontHeight = 20;
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontBold = NullableBool.True;
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FontItalic = NullableBool.True;
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.FillType = FillTypeEx.Solid;
series.Labels.TextProperties.Paragraphs[0].ParagraphFormat.DefaultPortionFormat.FillFormat.SolidFillColor.Color = Color.DarkGreen;

//Saving Presentation
pres.Write(“D:\Aspose Data\AxisValue.pptx”);

}


Please share, if I may help you further in this regard.

Many Thanks,

Thanks for your quick help and you are able to resolve most of our queries , please find below some more clarifications seeking from you , provide us your inputs and make us clear......

1) SetLegendMarker :

How to get the Automatic marker , which is applicable when no marker is set .Its available in OLE.

In OLE:
sSeries.Marker.MarkerStyle = ChartMarkerType.Automatic;

2) SetLegendBorder:

We are not able to find the option to set the legend border to different combinations of Gray Color(like DarkGray,LightGray and MediumGray)

borderLine = Aspose.Cells.Drawing.LineType.DarkGray;
borderLine = Aspose.Cells.Drawing.LineType.LightGray;
borderLine = Aspose.Cells.Drawing.LineType.MediumGray;
Also in OLE, Line type has only one option for DashDotDot , which is the compatible for that among LargeDashDot and SystemDashDot e.tc.,
borderLine = Aspose.Cells.Drawing.LineType.DashDotDot;

LineDashStyleEx.LargeDashDotDot;
LineDashStyleEx.SystemDashDotDot

3) ShowHideLegendBorder:

For Show and Hide Legend Border , there is no direct property to do so . Hence we have used below code to acheive it. Please suggest us , is this the best way to acheive it or any other properties will help us better.

if (isValue == false)
{
chart.Legend.Format.Line.FillFormat.FillType = FillTypeEx.NoFill;
}
else if (isValue == true)
{
chart.Legend.Format.Line.FillFormat.FillType = FillTypeEx.Solid;
}

Hi Venkat,


I have observed your requirements and will address them in order they have been inquired.

In order to set ChartMarkerType.Automatic equivalent in Aspose.Slides for .NET, please comment the following code snippet in the previously shared code snippet. By doing so, the automatic properties for series marker will be set. If any single property for chart series marker is set in your code then marker type of Built in will be set in generated chart.

/* series.MarkerSymbol = MarkerStyleTypeEx.Diamond;
series.MarkerSize = 20;
series.MarkerFill.Fill.FillType = FillTypeEx.Solid;
series.MarkerFill.Fill.SolidFillColor.Color = Color.RosyBrown;
series.MarkerFill.Line.Width= 2;
series.MarkerFill.Line.FillFormat.FillType=FillTypeEx.Solid;
series.MarkerFill.Line.FillFormat.SolidFillColor.Color = Color.Chocolate;
*/

For your inquiry related to border line styles as available in case of Ole frame chart, I like to share that request styles are not supported in case of MSO PowerPoint charts. For your convenience, I have attached the image depicting the line styles available in MSO PowerPoint charts and Aspose.Slides.

I have observed your code snippet for hiding the legend and it is the avaible option for hiding or showing legends of the chart.

Please share, if I may help you further in this regard.

Many Thanks,

Its great to hear from you back to back responses , Thanks for that.

While I am continuining my journey with some more functioanlities , found the below are little trickey and did not find suitable properties for MSO, So reaching you for the needful to resovle the issues.

1) SetCustomMarker:

In OLE:

FileStream fs = File.OpenRead(ConfigurationManager.AppSettings["ImageFilePathDirectory"].ToString() + imgFileNameList[s]);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
sSeries.Marker.MarkerStyle = ChartMarkerType.Square;
sSeries.Marker.MarkerSize = 20;
sSeries.Marker.Border.WeightPt = 2;
sSeries.Marker.Area.FillFormat.ImageData = data;
chart.ShowLegend = true

2) SetAxisTickLabelSpacing:

In OLE:
Aspose.Cells.Charts.Axis axis = chart.CategoryAxis;
axis.TickLabelSpacing = 2;

3) SetAxisTickMarkSpacing:

In OLE:
Aspose.Cells.Charts.Axis axis = chart.CategoryAxis;
axis.TickMarkSpacing = 2;

Hi Venkat,


I have observed your requirements for setting the image to marker symbol. You may need to use the following code snippet to serve the purpose but at the moment there seem to be an issue in setting the image to marker symbol. I have created an issue with ID SLIDESNET-33819 to further investigate and resolve the issue.

PresentationEx pres = new PresentationEx();
SlideEx slide = pres.Slides[0];
ChartEx chart = slide.Shapes.AddChart(ChartTypeEx.LineWithMarkers, 50, 50, 500, 400);

//working with chart series
ChartSeriesEx series = chart.ChartData.Series[0];


//Setting series marker and its properties for series
series.MarkerSymbol = MarkerStyleTypeEx.Diamond;
series.MarkerSize = 20;
//Set the picture
System.Drawing.Image img = (System.Drawing.Image)new Bitmap(@“D:\Aspose Data\Desert.jpg”);


ImageEx image = pres.Images.AddImage(img);
series.MarkerSymbol = MarkerStyleTypeEx.Picture;
series.MarkerFill.Fill.FillType = FillTypeEx.Picture;
series.MarkerFill.Fill.PictureFillFormat.Picture.Image = image;

series.MarkerFill.Line.Width= 2;
series.MarkerFill.Line.FillFormat.FillType=FillTypeEx.Solid;
series.MarkerFill.Line.FillFormat.SolidFillColor.Color = Color.Chocolate;

//Saving Presentation
pres.Write(“D:\Aspose Data\AxisValue.pptx”);

For your requirement related to setting the tick mark spacing, I regret to share that the feature is not even available in MS PowerPoint charts. For your convenience, I have attached the image highlighting the possible options as well.

Many Thanks,

Hi -

Can you please update me on the status of ......

1) Rotation Angle: SLIDESNET-33799

2) Marker Symbol : SLIDESNET-33819

and any time line by when it can be resolved, because we are curiously waiting for these functionalities. Hence please provide a date when you can close them. Thanks.

Regards

Venkat M.N

Hi Venkat,


Thanks for inquiring Aspose.Slides.

I have observed the issues status in our issue tracking system and regret to share that the issues are still waiting for investigation in queue. Actually, both issues have been shared just recently and we schedule issues on first come first serve basis for Aspose.Slides forum. Actually, there are already pending issues created earlier than yours and awaiting investigation. I will really appreciate your patience and interest in our product and will update you as soon as there will be further updates shared by our development team.

We are sorry for your inconvenience,


Hi Venkkat,


I like to share that the issue SLIDESNET-33799 related to providing the support for setting the rotation angle for value and category axis values has bee introduced in Aspose.Slides for .NET 7.1.0.

Please use the following sample code for your convenience.

PresentationEx presEx = new PresentationEx();
ChartEx chart = presEx.Slides[0].Shapes.AddChart(ChartTypeEx.StackedBar, 100, 100, 600, 300);

chart.ValueAxis.RotationAngle = 77;
chart.SecondValueAxis.RotationAngle = 155;

chart.CategoryAxis.RotationAngle = 77;
chart.SecondCategoryAxis.RotationAngle = 155;

I will share the product notification with you as soon as it will be available.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-33799;SLIDESNET-33819) have been fixed in this update.


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

Hi,

My 5th issue was setting the axis title rotation posted on 11-23-2012 (427507 thread)

5) Aspose.Cells.Charts.Axis axis = chart.CategoryAxis;
AxisTitleOrientation:
axis.Title.RotationAngle = Int32.Parse(angle); // title rotation for Value/Category axis

But in SLIDESNET-33799
It is rotating the axis values and not the title.

I am attaching the image also what actuall output is required.

Thanks,

Venkat

Hi Venkat,


Please use the following sample code to serve the purpose. Please share, if I may help you further in this regard.

TextFrameEx txt = chart.ValueAxis.Title.Text;
chart.ValueAxis.HasTitle = true;
txt.AnchoringType = TextAnchorTypeEx.Top;
txt.TextVerticalType = TextVerticalTypeEx.Horizontal;
txt.Text = “Hello Mudassir”;

Many Thanks,

Hi Mudassir ,

The above code is helping in setting the text verically and horizontally only.

Following options are available: -

txt.TextVerticalType = TextVerticalTypeEx.EastAsianVertical;
txt.TextVerticalType = TextVerticalTypeEx.Horizontal;
txt.TextVerticalType = TextVerticalTypeEx.MongolianVertical;
txt.TextVerticalType = TextVerticalTypeEx.NotDefined;
txt.TextVerticalType = TextVerticalTypeEx.Vertical;
txt.TextVerticalType = TextVerticalTypeEx.Vertical270;
txt.TextVerticalType = TextVerticalTypeEx.WordArtVertical;
txt.TextVerticalType = TextVerticalTypeEx.WordArtVerticalRightToLeft;

But in OLE we are having the option of setting the angle

axis = chart.CategoryAxis;
axis.Title.TextDirection = TextDirectionType.LeftToRight;
axis.Title.RotationAngle = Int32.Parse(angle);

Is there any way to do the same in MSO?

Thanks
Venkat

Hi Venkat,


I have observed your requirement for setting the custom angle for Axis title. I doubt that this feature is even not available in MSO Chart it self. For your kind reference, I have shared the image where by you can see that setting custom angle option is disabled for Axis Title. If you can figure out some way to set this on your end using PowerPoint then kindly share with us and I will try to help you further.

Many Thanks,


Hi,

This feature is available in MSO. While formatting the axis title go to Alignment and change the text direction to Horizontal. Then you can set the custom angle.

I am attaching the image for your reference.

Thanks,
Venkat

Hi Venkat,


Thanks for your further elaboration. I have been able to identify the requirements shared. I have created an issue with ID SLIDESNET-33974 as new feature request in our issue tracking system to further investigate the possibility of implementing the desired feature. This thread has been linked with the issue so that you may be automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

The issues you have found earlier (filed as SLIDESNET-33974) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by mudassir.fayyaz