ID-10068053

Today I Shed my Old Skin” - Og Mandino. This statement introduces the first scroll defined in one of the most compelling books I have ever red, The Greatest Salesman in the World. It has also been said - “There ought to be a better way.” I love this statement because at times it becomes the principle for moving us forward.

Representing time in a linear axis is a very ancient exercise; even more ancient that the conception of the Cartesian plane. Linear representation of time, indisputably, will continue to be an indispensable tradition in the illustration of change.

In programming, it is a habit to use OLE Automation Date (OADate), a numerical representation of time, in order to talk to the richest APIs and bring about the graphical representation of time. The approach has been adequate and successful at times, yet in instances it has lacked the flexibility that the representation of time inheritably has by nature.

“Today I shed my old Skin.” And I introduced a slight different approach to the OADate when dealing with time and time reference. This approach consists of time indexing, or the representation of time through simple integer unit.

In Telerik Reporting, You could observe the original approach by visiting this post

Telerik Reporting Vs. Simple OADate in Bar Chart

In a previous post, we unveiled some of the graph API by simple rendering some data in a bar chart.

Chart3_thumb

The above example is not practical in terms of illustration of time as you could see because it does not defined the xaxis. Thus, we could simple enough replace the axis integers by customizing. We could accomplish this in Telerik Reporting by simple adding custom xaxis labels.

   1: mychart.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Between;
   2: mychart.PlotArea.XAxis.IsZeroBased = true;
   3: mychart.PlotArea.XAxis.AutoScale = false;
   4: mychart.PlotArea.XAxis.AddRange(1, seriesItemPosition, 1);
   5: int sequence = 0;
   6: foreach (Product prd in _source.OrderBy(p => p.Date).Where(n => n.ProductName == "Product 1").Select(m => m).ToList<Product>())
   7: {
   8:     mychart.PlotArea.XAxis[sequence].TextBlock.Text = prd.Date.ToString("MMM");
   9:     
  10:     sequence++;
  11: }

Below is the resulted Chart

image

Index Approach and The Stock Market

The above example encapsulates the simplicity behind this task. The core concept is to focus on xaxis positioning rather than its representation. Further, we could change the representation of the axis. Following, I will provide a little more complex example, like a Security Historical Price - Microsoft Stock Price.

In the following example I utilize the Kelly Elias Method on getting historical stock prices from Yahoo – Get Historical Stock Data From Yahoo

   1: Telerik.Reporting.Chart mychart = new Telerik.Reporting.Chart();
   2: List<HistoricalStock> hs = new List<HistoricalStock>(YahooHistoricalLoader.DownloadData("MSFT", 2012).Where(f => f.Date >= new DateTime(2012, 1, 1)).OrderBy(t => t.Date).Select(m => m));
   3: mychart.Skin = "Office2007";
   4: ChartSeries series = new ChartSeries();
   5: int seriesItemPosition = 0;
   6: foreach (HistoricalStock hitem in hs)
   7: {
   8:         ChartSeriesItem seriesItem = new ChartSeriesItem();
   9:         seriesItem.YValue = hitem.Close;
  10:         seriesItem.XValue = seriesItemPosition++;
  11:         seriesItem.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
  12:         //Hide Series Item's Labels
  13:         seriesItem.Label.TextBlock.Visible = false;
  14:         series.Items.Add(seriesItem);
  15:        
  16: }
  17: mychart.Series.Add(series);

Customizing xaxis

We use the source data in order to provide interpretation to the xaxis, In the below, we display a xaxis label every 30 days. Thus, We add the xaxis labels programmatically, and adjust visibility based on this rule.

   1: // For Adding custom xAxis labels, must first do the below
   2: mychart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font(FontFamily.GenericSansSerif, 6, FontStyle.Regular);
   3: mychart.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Between;
   4: mychart.PlotArea.XAxis.IsZeroBased = true;
   5: mychart.PlotArea.XAxis.AutoScale = false;
   6: mychart.PlotArea.XAxis.AddRange(1, seriesItemPosition, 1);
   7: // Adding Dynamically
   8: int sequence = 0;
   9: foreach (HistoricalStock h in hs)
  10: {
  11:         mychart.PlotArea.XAxis[sequence].TextBlock.Text = h.Date.ToString("MMM, yyyy"); // provide meaning
  12:         mychart.PlotArea.XAxis[sequence].TextBlock.Visible = false;
  13:         if (sequence > 0 && sequence % 30 == 0)
  14:         {
  15:             mychart.PlotArea.XAxis[sequence].TextBlock.Visible = true;
  16:             mychart.PlotArea.XAxis[sequence].Appearance.RotationAngle = 45f;
  17:         }
  18:        sequence++;
  19: }

Below is the Resulted Chart

image

 

The Stock Market Chart Look and Feel

Now that we have completed our chart. The next step is to give our chart a more appropriate appearance that would emulate the Stock Market look and feel. We could accomplish this with a few strategies.

Chart YAxis Scaling.

First and foremost, every good stock market chart has a cleaner scaling on the yaxis, therefore, we will scale the axis relative the maximum and minimum value of the source.

   1: Double MaxValue = hs.Select(p => p.Close).Max() + 5;
   2: Double MinValue = hs.Select(p => p.Close).Min() - 5;
   3: mychart.PlotArea.YAxis.IsZeroBased = false;
   4: mychart.PlotArea.YAxis.AutoScale = false;
   5: mychart.PlotArea.YAxis.AddRange(MinValue, MaxValue, 5);

Zonification

Telerik Reporting has a great zoning feature. This feature enable defining zones relatively to the xaxis. We will zone each month.

   1: int[] ZoningSize = hs.GroupBy(p => p.Date.Month).Select(t => t.Count()).ToArray();
   2: int counter = 0;
   3: int monthSeq = 1;
   4: foreach (int z in ZoningSize)
   5: {
   6:     ChartMarkedZone zone = new ChartMarkedZone();
   7:     zone.ValueStartX = counter;
   8:     zone.ValueEndX = counter + z;
   9:     counter = counter + z;
  10:     zone.Label.TextBlock.Text = new DateTime(2012, monthSeq, 1).ToString("MMM");
  11:     zone.Appearance.Border.Color = Color.LightBlue;
  12:     zone.Label.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Bottom;
  13:     zone.Label.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 5, FontStyle.Bold);
  14:     monthSeq++;
  15:     mychart.PlotArea.MarkedZones.Add(zone);
  16: }

Since we are now using the zone labels, we then could hide xaxis labels. Below is the resulted chart.

image

Here is the Complete Source:

   1: public static Telerik.Reporting.Chart GetStockData()
   2:         {
   3:             Telerik.Reporting.Chart mychart = new Telerik.Reporting.Chart();
   4:             List<HistoricalStock> hs = new List<HistoricalStock>(YahooHistoricalLoader.DownloadData("MSFT", 2012).Where(f => f.Date >= new DateTime(2012, 1, 1)).OrderBy(t => t.Date).Select(m => m));
   5:             mychart.Skin = "Office2007";
   6:             #region XAxis and YAxis Labels
   7:                  mychart.PlotArea.XAxis.AxisLabel.TextBlock.Visible = true;
   8:                  mychart.PlotArea.YAxis.AxisLabel.TextBlock.Visible = true;
   9:  
  10:                  mychart.PlotArea.XAxis.AxisLabel.Visible = true;
  11:                  mychart.PlotArea.YAxis.AxisLabel.Visible = true;
  12:  
  13:                 mychart.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Period";
  14:                 mychart.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Price Per Share ($)";
  15:                 mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.Auto = true;
  16:                 mychart.PlotArea.YAxis.AxisLabel.Appearance.Position.Auto = true;
  17:             #endregion
  18:             int seriesItemPosition = 0;
  19:             mychart.ChartTitle.TextBlock.Text = "Microsoft Stock Price Historical";
  20:             mychart.ChartTitle.TextBlock.Appearance.TextProperties.Color = Color.Blue;
  21:             ChartSeries series = new ChartSeries();
  22:             foreach (HistoricalStock hitem in hs)
  23:             {
  24:                     ChartSeriesItem seriesItem = new ChartSeriesItem();
  25:                     seriesItem.YValue = hitem.Close;
  26:                     seriesItem.XValue = seriesItemPosition++;
  27:                     seriesItem.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
  28:                     seriesItem.Label.TextBlock.Visible = false;
  29:                     series.Items.Add(seriesItem);
  30:        
  31:             }
  32:             mychart.Series.Add(series);
  33:             #region Custom Legend
  34:                 LabelItem LegenItem = new LabelItem();
  35:                 LegenItem.Marker.Visible = true;
  36:                 LegenItem.Marker.Appearance.Figure = Telerik.Reporting.Charting.Styles.DefaultFigures.Rectangle;
  37:                 LegenItem.Marker.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
  38:                 LegenItem.Marker.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
  39:                 LegenItem.TextBlock.Text = "MSFT";
  40:                 #region Legend Location
  41:                     mychart.Legend.Appearance.Location = Telerik.Reporting.Charting.Styles.LabelLocation.OutsidePlotArea;
  42:                     mychart.Legend.Appearance.Overflow = Telerik.Reporting.Charting.Styles.Overflow.Row;
  43:                     mychart.Legend.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Bottom;
  44:                 #endregion
  45:                     mychart.Legend.Items.Add(LegenItem);
  46:             #endregion
  47:             series.Appearance.FillStyle.MainColor = System.Drawing.Color.Red;
  48:             series.Name = "MSFT";
  49:             series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
  50:             series.Type = ChartSeriesType.Spline;
  51:             #region EliminateGridlines
  52:                 mychart.PlotArea.YAxis.Appearance.MajorGridLines.Visible = false;
  53:                  mychart.PlotArea.YAxis.Appearance.MinorGridLines.Visible = false;
  54:                  mychart.PlotArea.XAxis.Appearance.MajorGridLines.Visible = false;
  55:                  mychart.PlotArea.XAxis.Appearance.MinorGridLines.Visible = false;
  56:             #endregion
  57:                 mychart.PlotArea.XAxis.Appearance.MinorTick.Visible = false;
  58:                  mychart.PlotArea.XAxis.Appearance.MajorTick.Visible = false;
  59:                  mychart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font(FontFamily.GenericSansSerif, 6, FontStyle.Regular);
  60:                  mychart.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Between;
  61:                  mychart.PlotArea.XAxis.IsZeroBased = true;
  62:                  mychart.PlotArea.XAxis.AutoScale = false;
  63:                  mychart.PlotArea.XAxis.AddRange(1, seriesItemPosition, 1);
  64:                  int sequence = 0;
  65:                  foreach (HistoricalStock h in hs)
  66:                  {
  67:                          mychart.PlotArea.XAxis[sequence].TextBlock.Text = h.Date.ToString("MMM, yyyy"); // provide meaning
  68:                          mychart.PlotArea.XAxis[sequence].TextBlock.Visible = false;
  69:                          //if (sequence > 0 && sequence % 30 == 0)
  70:                          //{
  71:                          //    mychart.PlotArea.XAxis[sequence].TextBlock.Visible = true;
  72:                          //    mychart.PlotArea.XAxis[sequence].Appearance.RotationAngle = 45f;
  73:                                                        
  74:                          //}
  75:                         sequence++;
  76:                }
  77:                  Telerik.Reporting.Drawing.Unit Height = new Telerik.Reporting.Drawing.Unit(8, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm)));
  78:                  Telerik.Reporting.Drawing.Unit Width = new Telerik.Reporting.Drawing.Unit(15, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm)));
  79:                  mychart.PlotArea.XAxis.AutoShrink = false;
  80:                  mychart.Size = new Telerik.Reporting.Drawing.SizeU(Width, Height);
  81:                  mychart.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.32, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm))), new Telerik.Reporting.Drawing.Unit(0.8, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm))));
  82:                  #region Configuration
  83:                      #region Reposition XAxis Label
  84:                         mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.Auto = false;
  85:                         mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.X  = 320;
  86:                         mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.Y = 320;
  87:                      #endregion
  88:                     mychart.PlotArea.Appearance.Dimensions.Margins.Bottom = 90;
  89:                     mychart.PlotArea.Appearance.Dimensions.Margins.Right = 32;
  90:                     mychart.PlotArea.Appearance.Dimensions.Margins.Left = 90;
  91:                  #endregion
  92:                      #region Scaling Chart YAxis
  93:                     Double MaxValue = hs.Select(p => p.Close).Max() + 5;
  94:                     Double MinValue = hs.Select(p => p.Close).Min() - 5;
  95:                     mychart.PlotArea.YAxis.IsZeroBased = false;
  96:                     mychart.PlotArea.YAxis.AutoScale = false;
  97:                     mychart.PlotArea.YAxis.AddRange(MinValue, MaxValue, 5);
  98:                      #endregion
  99:                    #region Zonification
 100:                     int[] ZoningSize = hs.GroupBy(p => p.Date.Month).Select(t => t.Count()).ToArray();
 101:                     int counter = 0;
 102:                     int monthSeq = 1;
 103:                     foreach (int z in ZoningSize)
 104:                     {
 105:                         ChartMarkedZone zone = new ChartMarkedZone();
 106:                         zone.ValueStartX = counter;
 107:                         zone.ValueEndX = counter + z;
 108:                         counter = counter + z;
 109:                         zone.Label.TextBlock.Text = new DateTime(2012, monthSeq, 1).ToString("MMM");
 110:                         zone.Appearance.Border.Color = Color.LightBlue;
 111:                         zone.Label.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Bottom;
 112:                         zone.Label.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 5, FontStyle.Bold);
 113:                         monthSeq++;
 114:                         mychart.PlotArea.MarkedZones.Add(zone);
 115:                     }
 116:                         #endregion
 117:  
 118:                         return mychart;
 119:         }

Stock Market 2012 Microsoft (MSFT) Vs. Apple (AAPL)

It is stated that two securities in the same industry may have the same level of risk due that they are both influence by the same market conditions and economic variables. If this is correct then they might move in the same direction.

By using using the above concepts, we go into exploring this idea graphically

image

Here is the Complete Source:

   1: public static Telerik.Reporting.Chart CompareTwoStocks()
   2:         {
   3:             Telerik.Reporting.Chart mychart = new Telerik.Reporting.Chart();
   4:             mychart.Skin = "Office2007";
   5:             string[] Stocks = new string[] { "MSFT", "AAPL"};
   6:             System.Drawing.Color[] seriesColor = new Color[]{ Color.Red, Color.Blue };
   7:             List<HistoricalStock>[] stockitems = new List<HistoricalStock>[2];
   8:             
   9:             int size = 0;
  10:             foreach(string symbol in Stocks)
  11:             {
  12:                 stockitems[size++] = new List<HistoricalStock>(YahooHistoricalLoader.DownloadData(symbol, 2012).Where(f => f.Date >= new DateTime(2012, 1, 1)).OrderBy(t => t.Date).Select(m => m));
  13:             }
  14:  
  15:                #region XAxis and YAxis Labels
  16:                 mychart.PlotArea.XAxis.AxisLabel.TextBlock.Visible = true;
  17:                 mychart.PlotArea.YAxis.AxisLabel.TextBlock.Visible = true;
  18:                 mychart.PlotArea.XAxis.AxisLabel.Visible = true;
  19:                 mychart.PlotArea.YAxis.AxisLabel.Visible = true;
  20:                 mychart.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Period";
  21:                 mychart.PlotArea.YAxis.AxisLabel.TextBlock.Text = "Price Per Share ($)";
  22:                 mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.Auto = true;
  23:                 mychart.PlotArea.YAxis.AxisLabel.Appearance.Position.Auto = true;
  24:             #endregion
  25:                 
  26:                 mychart.ChartTitle.TextBlock.Text = string.Join(" Vs. ", Stocks);
  27:                 mychart.ChartTitle.TextBlock.Appearance.TextProperties.Color = Color.Blue;
  28:                 #region Generate Chart Series
  29:                 for (int i = 0; i < size; i++)
  30:                 {
  31:                     ChartSeries series = new ChartSeries();
  32:                     int seriesItemPosition = 0;
  33:                     foreach (HistoricalStock hs in stockitems[i])
  34:                     {
  35:                         ChartSeriesItem seriesItem = new ChartSeriesItem();
  36:                         seriesItem.YValue = hs.Close;
  37:                         seriesItem.XValue = seriesItemPosition++;
  38:                         //seriesItem.Appearance.FillStyle.MainColor = seriesColor[i];
  39:                         // Hide the Graph Values on Series Item
  40:                         seriesItem.Label.TextBlock.Visible = false;
  41:                         series.Items.Add(seriesItem);
  42:                     }
  43:                     series.YAxisType = (i == 0) ? ChartYAxisType.Primary : ChartYAxisType.Secondary;
  44:                     series.Appearance.FillStyle.MainColor = seriesColor[i];
  45:                     series.Name = Stocks[i];
  46:                     series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.Nothing;
  47:                     series.Type = ChartSeriesType.Spline;
  48:                     mychart.Series.Add(series);
  49:                     
  50:                 }
  51:                 #endregion
  52:  
  53:                 #region Custom Legend
  54:                 int seq = 0;
  55:                 foreach (string symbol in Stocks)
  56:                 {
  57:                     LabelItem LegenItem = new LabelItem();
  58:                     LegenItem.Marker.Visible = true;
  59:                     LegenItem.Marker.Appearance.Figure = Telerik.Reporting.Charting.Styles.DefaultFigures.Rectangle;
  60:                     LegenItem.Marker.Appearance.FillStyle.MainColor = seriesColor[seq++];
  61:                     LegenItem.Marker.Appearance.FillStyle.FillType = Telerik.Reporting.Charting.Styles.FillType.Solid;
  62:                     LegenItem.TextBlock.Text = symbol;
  63:  
  64:                     mychart.Legend.Items.Add(LegenItem);
  65:                 }
  66:                     #region Legend Location
  67:                     mychart.Legend.Appearance.Location = Telerik.Reporting.Charting.Styles.LabelLocation.OutsidePlotArea;
  68:                     mychart.Legend.Appearance.Overflow = Telerik.Reporting.Charting.Styles.Overflow.Row;
  69:                     mychart.Legend.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Bottom;
  70:                     #endregion
  71:                 #endregion
  72:                 #region EliminateGridlines
  73:                 mychart.PlotArea.YAxis.Appearance.MajorGridLines.Visible = false;
  74:                 mychart.PlotArea.YAxis.Appearance.MinorGridLines.Visible = false;
  75:                 mychart.PlotArea.XAxis.Appearance.MajorGridLines.Visible = false;
  76:                 mychart.PlotArea.XAxis.Appearance.MinorGridLines.Visible = false;
  77:                 #endregion
  78:  
  79:                 #region Conguring XAxis
  80:                         mychart.PlotArea.XAxis.Appearance.MinorTick.Visible = false;
  81:                         mychart.PlotArea.XAxis.Appearance.MajorTick.Visible = false;
  82:                         mychart.PlotArea.XAxis.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font(FontFamily.GenericSansSerif, 6, FontStyle.Regular);
  83:                         mychart.PlotArea.XAxis.LayoutMode = Telerik.Reporting.Charting.Styles.ChartAxisLayoutMode.Between;
  84:                         mychart.PlotArea.XAxis.IsZeroBased = true;
  85:                         mychart.PlotArea.XAxis.AutoScale = false;
  86:                         mychart.PlotArea.XAxis.AddRange(1, stockitems[0].Count(), 1);
  87:                             int sequence = 0;
  88:                             foreach (HistoricalStock h in stockitems[0])
  89:                             {
  90:  
  91:                                 mychart.PlotArea.XAxis[sequence].TextBlock.Text = h.Date.ToString("MMM, yyyy");
  92:                                 mychart.PlotArea.XAxis[sequence].TextBlock.Visible = false;
  93:  
  94:                                 //if (sequence > 0 && sequence % 50 == 0)
  95:                                 //{
  96:                                 //    //mychart.PlotArea.XAxis[sequence].TextBlock.Visible = true;
  97:                                 //    mychart.PlotArea.XAxis[sequence].Appearance.RotationAngle = 45f;
  98:  
  99:                                 //}
 100:                                 sequence++;
 101:  
 102:                             }
 103:                       
 104:                 #endregion
 105:  
 106:                 #region Scaling Chart YAxis
 107:                     Double MaxValue = stockitems[0].Select(p => p.Close).Max() + 5;
 108:                     Double MinValue = stockitems[0].Select(p => p.Close).Min() - 5;
 109:                     mychart.PlotArea.YAxis.IsZeroBased = false;
 110:                     mychart.PlotArea.YAxis.AutoScale = false;
 111:                     mychart.PlotArea.YAxis.AddRange(MinValue, MaxValue, 5);
 112:                     /// second
 113:                     Double MaxValue2 = stockitems[1].Select(p => p.Close).Max() + 5;
 114:                     Double MinValue2 = stockitems[1].Select(p => p.Close).Min() - 5;
 115:                     mychart.PlotArea.YAxis2.IsZeroBased = false;
 116:                     mychart.PlotArea.YAxis2.AutoScale = false;
 117:                     mychart.PlotArea.YAxis2.AddRange(MinValue2, MaxValue2, 50);
 118:                 #endregion
 119:  
 120:                  #region Zonification
 121:                     int[] ZoningSize = stockitems[0].GroupBy(p => p.Date.Month).Select(t => t.Count()).ToArray();
 122:                     int counter = 0;
 123:                     int monthSeq = 1;
 124:                     foreach (int z in ZoningSize)
 125:                     {
 126:                         ChartMarkedZone zone = new ChartMarkedZone();
 127:                         zone.ValueStartX = counter;
 128:                         zone.ValueEndX = counter + z;
 129:                         counter = counter + z;
 130:                         zone.Label.TextBlock.Text = new DateTime(2012, monthSeq, 1).ToString("MMM");
 131:                         zone.Appearance.Border.Color = Color.LightBlue;
 132:                         zone.Label.Appearance.Position.AlignedPosition = Telerik.Reporting.Charting.Styles.AlignedPositions.Bottom;
 133:                         zone.Label.TextBlock.Appearance.TextProperties.Font = new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 5, FontStyle.Bold);
 134:                         monthSeq++;
 135:                         mychart.PlotArea.MarkedZones.Add(zone);
 136:                     }
 137:                     #endregion
 138:  
 139:                 #region Chart Location and Customization
 140:                     Telerik.Reporting.Drawing.Unit Height = new Telerik.Reporting.Drawing.Unit(8, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm)));
 141:                     Telerik.Reporting.Drawing.Unit Width = new Telerik.Reporting.Drawing.Unit(15, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm)));
 142:                     mychart.PlotArea.XAxis.AutoShrink = false;
 143:                     mychart.Size = new Telerik.Reporting.Drawing.SizeU(Width, Height);
 144:                     mychart.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.32, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm))), new Telerik.Reporting.Drawing.Unit(0.8, ((Telerik.Reporting.Drawing.UnitType)(Telerik.Reporting.Drawing.UnitType.Cm))));
 145:    
 146:                     #region Reposition XAxis Label
 147:                         mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.Auto = false;
 148:                         mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.X = 320;
 149:                         mychart.PlotArea.XAxis.AxisLabel.Appearance.Position.Y = 320;
 150:                     #endregion
 151:                     #region Reposition Graph
 152:                         mychart.PlotArea.Appearance.Dimensions.Margins.Bottom = 90;
 153:                         mychart.PlotArea.Appearance.Dimensions.Margins.Right = 80;
 154:                         mychart.PlotArea.Appearance.Dimensions.Margins.Left = 90;
 155:                     #endregion
 156:                     #endregion
 157:  
 158:                     return mychart;
 159:         }