Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with Excel Charting ... Please Help
I am drawing an excel chart using C#. But the chart is occupying entire plot
area no matter how many rows i give. I want to leave some space at the end of the chart. Suppose i am drawing chart for 400 rows, I want to see all the 400 rows on the x axis without omitting the blank rows. How can i do that. Following is my code Code Block/* Open the destination file */ xlBookScript = (Excel.Workbook)xlBooks.Open(sDestinationFile, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); xlSheetExtra = (Excel.Worksheet)xlBookScript.Worksheets["Extra"]; xlSheetScript = (Excel.Worksheet)xlBookScript.Worksheets[sSheetType]; xlChart = (Excel.Chart)xlBookScript.Charts.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing); xlRange = xlSheetScript.get_Range("B7:B400,D7:D400,J7:J400,O 7:O400", Type.Missing); xlChart.ChartWizard(xlRange, Excel.XlChartType.xlLineMarkers, Type.Missing, Excel.XlRowCol.xlColumns, Type.Missing, Type.Missing, false, sSheetType, Type.Missing, Type.Missing, Type.Missing); xlSeriesVol = (Excel.Series)xlChart.SeriesCollection(4); xlSeriesVol.AxisGroup = Excel.XlAxisGroup.xlSecondary; xlSeriesVol.ChartType = Excel.XlChartType.xlColumnClustered; xlZAxis = (Excel.Axis)xlChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary); xlZAxis.TickLabelPosition = Excel.XlTickLabelPosition.xlTickLabelPositionNone; xlZAxis.MajorTickMark = Excel.XlTickMark.xlTickMarkNone; xlZAxis.MaximumScale = 3 * xlZAxis.MaximumScale; xlZAxis.MinimumScale = 0; /* Give the location for the chart */ xlChart.Location(Excel.XlChartLocation.xlLocationA sObject, "Extra"); xlRange = (Excel.Range)xlSheetExtra.Rows.get_Item(iRowNo, Type.Missing); xlSheetExtra.Shapes.Item(sChartNo).Top = (float)(double)xlRange.Top; xlRange = (Excel.Range)xlSheetExtra.Columns.get_Item(1, Type.Missing); xlSheetExtra.Shapes.Item(sChartNo).Left = (float)(double)xlRange.Left; xlSheetExtra.Shapes.Item(sChartNo).Height = 380; xlSheetExtra.Shapes.Item(sChartNo).Width = 710; xlBookScript.Close(true, Type.Missing, Type.Missing); |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem with Excel Charting ... Please Help
Is the first column for X values? Does row 7 contain column headers? If both
of these answers are "yes", then clear cell B7. If only the first is true, put headers in D6, J6, and O6, and make sure B6 is blank, and extend the range to include row 6. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "zoddiax" wrote in message ... I am drawing an excel chart using C#. But the chart is occupying entire plot area no matter how many rows i give. I want to leave some space at the end of the chart. Suppose i am drawing chart for 400 rows, I want to see all the 400 rows on the x axis without omitting the blank rows. How can i do that. Following is my code Code Block/* Open the destination file */ xlBookScript = (Excel.Workbook)xlBooks.Open(sDestinationFile, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); xlSheetExtra = (Excel.Worksheet)xlBookScript.Worksheets["Extra"]; xlSheetScript = (Excel.Worksheet)xlBookScript.Worksheets[sSheetType]; xlChart = (Excel.Chart)xlBookScript.Charts.Add(Type.Missing, Type.Missing, Type.Missing, Type.Missing); xlRange = xlSheetScript.get_Range("B7:B400,D7:D400,J7:J400,O 7:O400", Type.Missing); xlChart.ChartWizard(xlRange, Excel.XlChartType.xlLineMarkers, Type.Missing, Excel.XlRowCol.xlColumns, Type.Missing, Type.Missing, false, sSheetType, Type.Missing, Type.Missing, Type.Missing); xlSeriesVol = (Excel.Series)xlChart.SeriesCollection(4); xlSeriesVol.AxisGroup = Excel.XlAxisGroup.xlSecondary; xlSeriesVol.ChartType = Excel.XlChartType.xlColumnClustered; xlZAxis = (Excel.Axis)xlChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary); xlZAxis.TickLabelPosition = Excel.XlTickLabelPosition.xlTickLabelPositionNone; xlZAxis.MajorTickMark = Excel.XlTickMark.xlTickMarkNone; xlZAxis.MaximumScale = 3 * xlZAxis.MaximumScale; xlZAxis.MinimumScale = 0; /* Give the location for the chart */ xlChart.Location(Excel.XlChartLocation.xlLocationA sObject, "Extra"); xlRange = (Excel.Range)xlSheetExtra.Rows.get_Item(iRowNo, Type.Missing); xlSheetExtra.Shapes.Item(sChartNo).Top = (float)(double)xlRange.Top; xlRange = (Excel.Range)xlSheetExtra.Columns.get_Item(1, Type.Missing); xlSheetExtra.Shapes.Item(sChartNo).Left = (float)(double)xlRange.Left; xlSheetExtra.Shapes.Item(sChartNo).Height = 380; xlSheetExtra.Shapes.Item(sChartNo).Width = 710; xlBookScript.Close(true, Type.Missing, Type.Missing); |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Charting Problem | Excel Discussion (Misc queries) | |||
Problem with Excel Charting ... Please Help | Charts and Charting in Excel | |||
charting problem in Excel 2007 | Excel Discussion (Misc queries) | |||
Excel 2007 C# Charting problem | Charts and Charting in Excel | |||
Excel Charting problem.. | Excel Discussion (Misc queries) |