Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
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.charting
external usenet poster
 
Posts: 6,582
Default Problem with Excel Charting ... Please Help

There is no mention of the PlotArea in your code. You have to tell Excel to
make it some size other than the default.

- 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
Any new developments in the Excel 2007 slow charting problem? [email protected] Excel Discussion (Misc queries) 6 October 24th 07 02:21 PM
charting problem in Excel 2007 mk Excel Discussion (Misc queries) 4 September 5th 07 11:30 PM
Excel 2007 C# Charting problem [email protected] Charts and Charting in Excel 1 September 26th 06 03:46 AM
Excel 2007 Beta Charting Problem/Question kevjoh Charts and Charting in Excel 2 June 22nd 06 08:18 PM
Excel Charting problem.. Alex Excel Discussion (Misc queries) 1 August 5th 05 02:57 PM


All times are GMT +1. The time now is 05:17 PM.

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

About Us

"It's about Microsoft Excel"