Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Charting Problem Gemini Excel Discussion (Misc queries) 2 April 14th 08 06:55 PM
Problem with Excel Charting ... Please Help zoddiax Charts and Charting in Excel 1 October 11th 07 07:58 PM
charting problem in Excel 2007 mk Excel Discussion (Misc queries) 4 September 5th 07 10:30 PM
Excel 2007 C# Charting problem [email protected] Charts and Charting in Excel 1 September 26th 06 02:46 AM
Excel Charting problem.. Alex Excel Discussion (Misc queries) 1 August 5th 05 01:57 PM


All times are GMT +1. The time now is 09:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"