Hi,
I am using Aspose cell to plot chart. Can you please tell me how to set labels for Category Axis.
I need to assign category axis with label like “1-Jan-2013” , “4-May-2013” etc…
Regards
Aniket
Hi,
Hi,
Thanks for the reply.
Hi,
Thanks for the suggestion. Its working for me.
I have an additional question, Can we hide legend’s in excel chart’s using Aspose.cell.
Regards,
Aniket
Hi,
Hi!
yashalibansod25:-------------------------------------------------------------------------------------------------------------------//I cant see any button added in my chart//Chart: [ int ChartIndex = ChartWorksheet.Charts.Add(Aspose.Cells.Charts.ChartType.Line, 1, 1, 30, 14); ]Aspose.Cells.Drawing.Button button = chart.Shapes.AddButton( 2,0,2,0,10,30);button.Text = "Home";button.Placement = Aspose.Cells.Drawing.PlacementType.Move;//FreeFloating;button.FillFormat.ForeColor = Color.LightGray;-------------------------------------------------------------------------------------------------------------------//I am unable to add labels also.Is this an issue with the coordinates that I am providing?Aspose.Cells.Drawing.Label LabelSource = chart.Shapes.AddLabelInChart(20, 2, 35, 40);LabelSource.Text = "Source: ";LabelSource.Placement = Aspose.Cells.Drawing.PlacementType.FreeFloating;-------------------------------------------------------------------------------------------------------------------Please see the sample code below and the output attached Excel file which contains a label and a button control in the chart fine for your reference (I am just adding the controls to the designer chart in the template file):e.gSample code://Create a new Workbook.//Open the existing file.Workbook workbook = new Workbook("e:\\test\\exp_piechart.xls");//Get the designer chart in the second sheet.Worksheet sheet = workbook.Worksheets[1];Aspose.Cells.Charts.Chart chart = sheet.Charts[0];//Add a new label to the chart.Aspose.Cells.Drawing.Label label = chart.Shapes.AddLabelInChart(100, 100, 250, 830);//Set the caption of the label.label.Text = "A Label In Chart";//Set the Placement Type, the way the//label is attached to the cells.label.Placement = Aspose.Cells.Drawing.PlacementType.FreeFloating;//Set the fill color of the label.label.FillFormat.ForeColor = Color.Azure;//Add a new button to the chart.Aspose.Cells.Drawing.Button button = (Aspose.Cells.Drawing.Button)chart.Shapes.AddShapeInChart(MsoDrawingType.Button, PlacementType.FreeFloating, 500, 400, 2800, 540);//Set the caption of the label.button.Text = "A Button In Chart";//Save the excel file.workbook.Save("e:\\test2\\outtstlabelbuttonchart_2.xls");yashalibansod25://Also, How to change the format of the tick labels? I have dates in dd-mm-yyyy format as a //string in a column that are being used by the chart to plot the series.I havent set the cell //format for the column to have only dates filled in them. I want the tick label format on x axis //to be mmm-yy. But the following doesnt work for me :chart.CategoryAxis.CategoryType = Aspose.Cells.Charts.CategoryType.CategoryScale;//chart.CategoryAxis.MajorUnitScale = Aspose.Cells.Charts.TimeUnit.Months;(doesnt work)//chart.CategoryAxis.MajorUnit = 30.0;chart.CategoryAxis.BaseUnitScale = Aspose.Cells.Charts.TimeUnit.Months;chart.CategoryAxis.TickLabels.NumberFormat = "mmm-yy";chart.CategoryAxis.MajorTickMark = TickMarkType.Inside;chart.CategoryAxis.TickLabelSpacing = 30;chart.CategoryAxis.TickMarkSpacing = 30;-------------------------------------------------------------------------------------------------------------------Well, applying datetime formatting would only work if the underlying cells contains DateTime values, make sure the values are DateTime and not string values.yashalibansod25:How do i change the color of the series line?chart.NSeries[SeriesIndex].Area.ForegroundColor = Color.LightBlue; // Isnt working for me
Hi!
yashalibansod25:-------------------------------------------------------------------------------------------------------------------I haven't been able to figure out how to apply 3d format to a shape in a chart.here's a code snippet:Aspose.Cells.Drawing.RectangleShape rect = (Aspose.Cells.Drawing.RectangleShape)chart.Shapes.AddShapeInChart(MsoDrawingType.Rectangle, PlacementType.FreeFloating, 20, 30, 320,150 );rect.Text = "Home";rect.AutoShapeType = AutoShapeType.RoundedRectangle;rect.FillFormat.ForeColor = Color.LightGray;-------------------------------------------------------------------------------------------------------------------
http://www.aspose.com/docs/display/cellsnet/Applying+3D+Format
yashalibansod25:I also want to disable all the cells in the sheet. How to do that?-------------------------------------------------------------------------------------------------------------------
yashalibansod25:how to lock the chart in a fixed position without having to protect the sheet?-------------------------------------------------------------------------------------------------------------------