LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 8
Default How to keep source data for the Excel Charts constant ... Please H

Hi,

I am creating excel charts using C#. The range for creating chart is from
Row1 to Row400. After the chart is created, first 100 rows need to be
deleted. When I delete the first 100 rows (Row1 to Row100), the data range
for chart reduces to 300 (Row1 to Row300). I dont want this to happen.

I want that the source data range should always remain constant i.e. from
Row1 to Row400.

Code Snippet

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,F7:F400,H7:H400,J 7:J400,O7: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);



/* Format the chart for white background formatting */

xlChart.PlotArea.Interior.ColorIndex = 48;

xlChart.ChartTitle.Font.Size = 10;

xlChart.ChartArea.Border.ColorIndex = 1;

xlXAxis = (Excel.Axis)xlChart.Axes(Excel.XlAxisType.xlCatego ry,
Excel.XlAxisGroup.xlPrimary);

xlYAxis = (Excel.Axis)xlChart.Axes(Excel.XlAxisType.xlValue,
Excel.XlAxisGroup.xlPrimary);

xlXAxis.TickLabels.Orientation =
Excel.XlTickLabelOrientation.xlTickLabelOrientatio nHorizontal;

xlXAxis.TickLabelSpacing = 25;

xlXAxis.TickMarkSpacing = 25;

xlXAxis.TickLabels.Font.Size = 9;

xlYAxis.TickLabels.Font.Size = 9;

xlYAxis.TickLabels.NumberFormat = "0";

xlXAxis.Border.ColorIndex = 1;

xlYAxis.Border.ColorIndex = 1;

xlSeriesB = (Excel.Series)xlChart.SeriesCollection(1);

xlSeriesF = (Excel.Series)xlChart.SeriesCollection(2);

xlSeriesH = (Excel.Series)xlChart.SeriesCollection(3);

xlSeriesJ = (Excel.Series)xlChart.SeriesCollection(4);

xlSeriesB.XValues = xlSheetScript.get_Range("A7", "A401");

xlSeriesB.MarkerStyle = Excel.XlMarkerStyle.xlMarkerStyleNone;

xlSeriesF.MarkerStyle = Excel.XlMarkerStyle.xlMarkerStyleNone;

xlSeriesH.MarkerStyle = Excel.XlMarkerStyle.xlMarkerStyleNone;

xlSeriesJ.MarkerStyle = Excel.XlMarkerStyle.xlMarkerStyleNone;

xlSeriesB.Border.Weight = Excel.XlBorderWeight.xlThin;

xlSeriesF.Border.Weight = Excel.XlBorderWeight.xlThin;

xlSeriesH.Border.Weight = Excel.XlBorderWeight.xlThin;

xlSeriesJ.Border.Weight = Excel.XlBorderWeight.xlThin;

xlSeriesB.Border.ColorIndex = 1;

xlSeriesF.Border.ColorIndex = 6;

xlSeriesH.Border.ColorIndex = 9;

xlSeriesJ.Border.ColorIndex = 5;



/* Format the Volume axis */

xlSeriesVol = (Excel.Series)xlChart.SeriesCollection(5);

xlSeriesVol.AxisGroup = Excel.XlAxisGroup.xlSecondary;

xlSeriesVol.ChartType = Excel.XlChartType.xlColumnClustered;

xlSeriesVol.Fill.ForeColor.SchemeColor = 19;

xlZAxis = (Excel.Axis)xlChart.Axes(Excel.XlAxisType.xlValue,
Excel.XlAxisGroup.xlSecondary);

xlZAxis.TickLabelPosition = Excel.XlTickLabelPosition.xlTickLabelPositionNone;

xlZAxis.MajorTickMark = Excel.XlTickMark.xlTickMarkNone;

xlZAxis.MaximumScale = 5 * xlZAxis.MaximumScale;

xlZAxis.MinimumScale = 0;


 
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
Copying Charts While Changing Source Data David Haley Charts and Charting in Excel 8 August 2nd 07 04:50 PM
Editing Source Data in Charts F. Lawrence Kulchar Charts and Charting in Excel 1 November 5th 06 03:18 PM
extending source data in several charts Mike Charts and Charting in Excel 4 November 29th 05 05:37 AM
data source remain constant maryj Charts and Charting in Excel 1 October 28th 05 12:50 PM
Charts not recognizing source data if original linked data is changed. JLC Charts and Charting in Excel 3 October 14th 05 01:29 AM


All times are GMT +1. The time now is 02:51 AM.

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"