Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Web.DataVisualization / Common / General / ChartSerializer.cs
1 //-------------------------------------------------------------
2 // <copyright company=\92Microsoft Corporation\92>
3 //   Copyright © Microsoft Corporation. All Rights Reserved.
4 // </copyright>
5 //-------------------------------------------------------------
6 // @owner=alexgor, deliant
7 //=================================================================
8 //  File:               ChartSerializer.cs
9 //
10 //  Namespace:  System.Web.UI.WebControls[Windows.Forms].Charting
11 //
12 //      Classes:        ChartSerializer
13 //
14 //  Purpose:    Serialization saves the state of the chart and also 
15 //              provides the ability to load the serialized data back
16 //              into the chart. All chart properties can be persisted, 
17 //              including the chart's data.
18 //
19 //              ChartSerializer class only provides serialization API
20 //              for the user and actual serialization is performed by
21 //              XmlFormatSerializer or BinaryFormatserializer classes
22 //              depending on the Format property.
23 //
24 //      Reviewed:       AG - Jul 31, 2002
25 //              GS - Aug 7, 2002
26 //              AG - Microsoft 15, 2007
27 //
28 //===================================================================
29
30 #region Used namespaces
31
32 using System;
33 using System.IO;
34 using System.Xml;
35 using System.Collections;
36 using System.ComponentModel;
37 using System.ComponentModel.Design;
38
39 #if Microsoft_CONTROL
40         using System.Windows.Forms.DataVisualization.Charting.Data;
41         using System.Windows.Forms.DataVisualization.Charting.ChartTypes;
42         using System.Windows.Forms.DataVisualization.Charting.Utilities;
43         using System.Windows.Forms.DataVisualization.Charting;
44 #else
45         using System.Web.UI.DataVisualization.Charting;
46         using System.Web.UI.DataVisualization.Charting.Utilities;
47 #endif
48
49
50 #endregion
51
52 #if Microsoft_CONTROL
53         namespace System.Windows.Forms.DataVisualization.Charting
54 #else
55 namespace System.Web.UI.DataVisualization.Charting
56
57 #endif
58 {
59         #region Serialization enumeration
60
61         /// <summary>
62         /// An enumeration of the formats of the chart serializer.
63         /// </summary>
64         public enum SerializationFormat
65         {
66                 /// <summary>
67                 /// XML serializer format.
68                 /// </summary>
69                 Xml,
70
71                 /// <summary>
72                 /// Binary serializer format.
73                 /// </summary>
74                 Binary
75         }
76
77
78         /// <summary>
79         /// An enumeration of chart serializable content definition flags
80         /// </summary>
81         [Flags]
82         public enum SerializationContents 
83         {
84                 /// <summary>
85                 /// Default content.
86                 /// </summary>
87                 Default = 1,
88
89                 /// <summary>
90                 /// Serialize only series data.
91                 /// </summary>
92                 Data = 2,
93
94                 /// <summary>
95                 /// Serialize chart visual appearance (e.g. Colors, Line Styles).
96                 /// </summary>
97                 Appearance = 4,
98
99                 /// <summary>
100                 /// All content is serialized. 
101                 /// </summary>
102                 All = Default | Data | Appearance
103
104         }
105
106         #endregion
107
108         /// <summary>
109     /// ChartSerializer class provides chart serialization.
110         /// </summary>
111         [
112                 SRDescription("DescriptionAttributeChartSerializer_ChartSerializer"),
113                 DefaultProperty("Format"),
114         ]
115 #if ASPPERM_35
116         [AspNetHostingPermission(System.Security.Permissions.SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
117     [AspNetHostingPermission(System.Security.Permissions.SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
118 #endif
119     public class ChartSerializer 
120         {
121                 #region Private fields
122
123                 // Reference to the service container
124                 private IServiceContainer               _serviceContainer = null;
125
126                 // Reference to the chart object
127                 private Chart                                   _chart = null;
128
129                 // Reference to the serializer object
130
131                 private SerializerBase                  _serializer = new XmlFormatSerializer();
132
133                 // Format of the serializer in use
134                 private SerializationFormat             _format = SerializationFormat.Xml;
135
136                 // Serialization content 
137                 private SerializationContents   _content  = SerializationContents .Default;
138
139                 #endregion
140
141                 #region Constructors and Service Provider methods
142
143                 /// <summary>
144                 /// Default constructor is unavailable
145                 /// </summary>
146                 private ChartSerializer()
147                 {
148                 }
149
150                 /// <summary>
151                 /// Internal constructor
152                 /// </summary>
153                 /// <param name="container">Service container reference.</param>
154         internal ChartSerializer(IServiceContainer container)
155                 {
156                         if(container == null)
157                         {
158                                 throw(new ArgumentNullException(SR.ExceptionInvalidServiceContainer));
159                         }
160                         _serviceContainer = container;
161                 }
162
163                 /// <summary>
164                 /// Returns ChartSerializer service object
165                 /// </summary>
166                 /// <param name="serviceType">Requested service type.</param>
167                 /// <returns>ChartSerializer service object.</returns>
168                 internal object GetService(Type serviceType)
169                 {
170                         if(serviceType == typeof(ChartSerializer))
171                         {
172                                 return this;
173                         }
174                         throw (new ArgumentException( SR.ExceptionChartSerializerUnsupportedType( serviceType.ToString())));
175                 }
176
177                 #endregion
178
179                 #region Public properties
180
181                 /// <summary>
182                 /// Gets or sets the serializable content.
183                 /// </summary>
184                 [
185                 SRCategory("CategoryAttributeMisc"),
186                 DefaultValue(typeof(SerializationContents ), "Default"),
187                 SRDescription("DescriptionAttributeChartSerializer_Content")
188                 ]
189                 public SerializationContents  Content
190                 {
191                         get
192                         {
193                                 return _content;
194                         }
195                         set
196                         {
197                                 // Set content value
198                                 _content = value;
199
200                                 // Automatically set SerializableContent and NonSerializableContent properties
201                                 SetSerializableContent();
202                         }
203                 }
204
205                 /// <summary>
206                 /// Gets or sets the format used to serialize the chart data.
207                 /// </summary>
208                 [
209                 SRCategory("CategoryAttributeMisc"),
210                 DefaultValue(typeof(SerializationFormat), "Xml"),
211                 SRDescription("DescriptionAttributeChartSerializer_Format")
212                 ]
213                 public SerializationFormat Format
214                 {
215                         get
216                         {
217                                 return _format;
218                         }
219                         set
220                         {
221                                 if(_format != value)
222                                 {
223                                         _format = value;
224
225                                         // Create new serializer object
226                                         SerializerBase newSerializer = null;
227
228                                         if(_format == SerializationFormat.Binary)
229                                         {
230                                                 newSerializer = new BinaryFormatSerializer();
231                                         }
232                                         else
233                                         {
234                                                 newSerializer = new XmlFormatSerializer();
235                                         }
236                                         // Copy serializer settings
237                                         newSerializer.IsUnknownAttributeIgnored = _serializer.IsUnknownAttributeIgnored;
238                                         newSerializer.NonSerializableContent = _serializer.NonSerializableContent;
239                                         newSerializer.IsResetWhenLoading = _serializer.IsResetWhenLoading;
240                                         newSerializer.SerializableContent = _serializer.SerializableContent;
241                                         _serializer = newSerializer;
242                                 }
243                         }
244                 }
245
246                 /// <summary>
247                 /// Gets or sets a flag which indicates whether object properties are reset to default
248                 /// values before loading.
249                 /// </summary>
250                 [
251                 SRCategory("CategoryAttributeMisc"),
252                 DefaultValue(true),
253                 SRDescription("DescriptionAttributeChartSerializer_ResetWhenLoading")
254                 ]
255                 public bool IsResetWhenLoading
256                 {
257                         get
258                         {
259                                 return _serializer.IsResetWhenLoading;
260                         }
261                         set
262                         {
263                                 _serializer.IsResetWhenLoading = value;
264                         }
265                 }
266
267
268
269                 /// <summary>
270                 /// Gets or sets a flag which indicates whether unknown XML properties and elements will be 
271                 /// ignored without throwing an exception.
272                 /// </summary>
273                 [
274                 SRCategory("CategoryAttributeMisc"),
275                 DefaultValue(false),
276                 SRDescription("DescriptionAttributeChartSerializer_IgnoreUnknownXmlAttributes")
277                 ]
278                 public bool IsUnknownAttributeIgnored
279                 {
280                         get
281                         {
282                                 return _serializer.IsUnknownAttributeIgnored;
283                         }
284                         set
285                         {
286                                 _serializer.IsUnknownAttributeIgnored = value;
287                         }
288                 }
289
290                 /// <summary>
291                 /// Gets or sets a flag which indicates whether chart 
292         /// serializer is working in template creation mode.
293                 /// </summary>
294                 [
295                 SRCategory("CategoryAttributeMisc"),
296                 DefaultValue(false),
297                 SRDescription("DescriptionAttributeChartSerializer_TemplateMode")
298                 ]
299                 public bool IsTemplateMode
300                 {
301                         get
302                         {
303                                 return _serializer.IsTemplateMode;
304                         }
305                         set
306                         {
307                                 _serializer.IsTemplateMode = value;
308                         }
309                 }
310
311
312
313                 /// <summary>
314         /// Gets or sets the chart properties that can be serialized.
315         /// Comma separated list of serializable (Save/Load/Reset) properties. 
316                 /// "ClassName.PropertyName,[ClassName.PropertyName]".
317                 /// </summary>
318                 [
319                 SRCategory("CategoryAttributeMisc"),
320                 DefaultValue(""),
321                 SRDescription("DescriptionAttributeChartSerializer_SerializableContent")
322                 ]
323                 public string SerializableContent
324                 {
325                         get
326                         {
327                                 return _serializer.SerializableContent;
328                         }
329                         set
330                         {
331                                 _serializer.SerializableContent = value;
332                         }
333                 }
334
335                 /// <summary>
336         /// Gets or sets the chart properties that will not be serialized.
337                 /// Comma separated list of non-serializable (Save/Load/Reset) properties. 
338                 /// "ClassName.PropertyName,[ClassName.PropertyName]".
339                 /// </summary>
340                 [
341                 SRCategory("CategoryAttributeMisc"),
342                 DefaultValue(""),
343                 SRDescription("DescriptionAttributeChartSerializer_NonSerializableContent")
344                 ]
345                 public string NonSerializableContent
346                 {
347                         get
348                         {
349                                 return _serializer.NonSerializableContent;
350                         }
351                         set
352                         {
353                                 _serializer.NonSerializableContent = value;
354                         }
355                 }
356
357                 #endregion
358
359                 #region Public methods
360
361                 /// <summary>
362                 /// This method resets all properties of the chart to default values. By setting Content or 
363                 /// SerializableContent/NonSerializableContent properties, specific set of 
364                 /// properties can be reset.
365                 /// </summary>
366                 public void Reset()
367                 {
368                         // Set serializing flag
369                         if(GetChartObject() != null)
370                         {
371                                 GetChartObject().serializing = true;
372                 GetChartObject().serializationStatus = SerializationStatus.Resetting;
373                         }
374
375                         // Reset properties
376                         _serializer.ResetObjectProperties(GetChartObject());
377
378                         // Clear serializing flag
379                         if(GetChartObject() != null)
380                         {
381                                 GetChartObject().serializing = false;
382                 GetChartObject().serializationStatus = SerializationStatus.None;
383                         }
384                 }
385
386                 /// <summary>
387                 /// This method saves all properties of the chart into a file. By setting Content or 
388                 /// SerializableContent/NonSerializableContent properties, specific set of 
389                 /// properties can be saved.
390                 /// </summary>
391                 /// <param name="fileName">The file name used to write the data.</param>
392                 public void Save(string fileName)
393                 {
394             //Check arguments
395             if (fileName == null)
396                 throw new ArgumentNullException("fileName");
397
398                         // Set serializing flag
399                         if(GetChartObject() != null)
400                         {
401                                 GetChartObject().serializing = true;
402                 GetChartObject().serializationStatus = SerializationStatus.Saving;
403                                 //GetChartObject().BeginInit();
404                         }
405
406                         // Reset all auto-detected properties values
407                         GetChartObject().ResetAutoValues();
408
409                         // Serialize chart data
410                         _serializer.Serialize(GetChartObject(), fileName);
411
412                         // Clear serializing flag
413                         if(GetChartObject() != null)
414                         {
415                                 GetChartObject().serializing = false;
416                 GetChartObject().serializationStatus = SerializationStatus.None;
417                                 //GetChartObject().EndInit();
418                         }
419                 }
420
421                 /// <summary>
422                 /// This method saves all properties of the chart into a stream.  By setting Content or 
423                 /// SerializableContent/NonSerializableContent properties, specific set of 
424                 /// properties can be saved.
425                 /// </summary>
426                 /// <param name="stream">The stream where to save the data.</param>
427                 public void Save(Stream stream)
428                 {
429             //Check arguments
430             if (stream == null)
431                 throw new ArgumentNullException("stream");
432
433                         // Set serializing flag
434                         if(GetChartObject() != null)
435                         {
436                                 GetChartObject().serializing = true;
437                 GetChartObject().serializationStatus = SerializationStatus.Saving;
438                                 //GetChartObject().BeginInit();
439                         }
440
441                         // Reset all auto-detected properties values
442                         GetChartObject().ResetAutoValues();
443
444                         // Serialize chart data
445                         _serializer.Serialize(GetChartObject(), stream);
446
447                         // Clear serializing flag
448                         if(GetChartObject() != null)
449                         {
450                                 GetChartObject().serializing = false;
451                 GetChartObject().serializationStatus = SerializationStatus.None;
452                                 //GetChartObject().EndInit();
453                         }
454                 }
455
456                 /// <summary>
457                 /// This method saves all properties of the chart into an XML writer. By setting Content or 
458                 /// SerializableContent/NonSerializableContent properties, specific set of 
459                 /// properties can be saved.
460                 /// </summary>
461                 /// <param name="writer">XML writer to save the data.</param>
462                 public void Save(XmlWriter writer)
463                 {
464             //Check arguments
465             if (writer == null)
466                 throw new ArgumentNullException("writer");
467
468                         // Set serializing flag
469                         if(GetChartObject() != null)
470                         {
471                                 GetChartObject().serializing = true;
472                 GetChartObject().serializationStatus = SerializationStatus.Saving;
473                                 //GetChartObject().BeginInit();
474                         }
475
476                         // Reset all auto-detected properties values
477                         GetChartObject().ResetAutoValues();
478
479                         // Serialize chart data
480                         _serializer.Serialize(GetChartObject(), writer);
481
482                         // Clear serializing flag
483                         if(GetChartObject() != null)
484                         {
485                                 GetChartObject().serializing = false;
486                 GetChartObject().serializationStatus = SerializationStatus.None;
487                                 //GetChartObject().EndInit();
488                         }
489                 }
490
491                 /// <summary>
492                 /// This method saves all properties of the chart into a text writer.  By setting Content or 
493                 /// SerializableContent/NonSerializableContent properties, specific set of 
494                 /// properties can be saved.
495                 /// </summary>
496                 /// <param name="writer">Text writer to save the data.</param>
497                 public void Save(TextWriter writer)
498                 {
499             //Check arguments
500             if (writer == null)
501                 throw new ArgumentNullException("writer");
502
503                         // Set serializing flag
504                         if(GetChartObject() != null)
505                         {
506                                 GetChartObject().serializing = true;
507                 GetChartObject().serializationStatus = SerializationStatus.Saving;
508                                 //GetChartObject().BeginInit();
509                         }
510
511                         // Reset all auto-detected properties values
512                         GetChartObject().ResetAutoValues();
513
514                         // Serialize chart data
515                         _serializer.Serialize(GetChartObject(), writer);
516
517                         // Clear serializing flag
518                         if(GetChartObject() != null)
519                         {
520                                 GetChartObject().serializing = false;
521                 GetChartObject().serializationStatus = SerializationStatus.None;
522                                 //GetChartObject().EndInit();
523                         }
524                 }
525
526                 /// <summary>
527                 /// This method loads all properties of the chart from a file. By setting Content or 
528                 /// SerializableContent/NonSerializableContent properties, specific set of 
529                 /// properties can be loaded.
530                 /// </summary>
531                 /// <param name="fileName">The file to load the data from.</param>
532                 public void Load(string fileName)
533                 {
534             //Check arguments
535             if (fileName == null)
536                 throw new ArgumentNullException("fileName");
537             
538             // Set serializing flag
539                         if(GetChartObject() != null)
540                         {
541                                 GetChartObject().serializing = true;
542                 GetChartObject().serializationStatus = SerializationStatus.Loading;
543                         }
544
545                         _serializer.Deserialize(GetChartObject(), fileName);
546
547                         // Clear serializing flag
548                         if(GetChartObject() != null)
549                         {
550                                 GetChartObject().serializing = false;
551                 GetChartObject().serializationStatus = SerializationStatus.None;
552                         }
553                 }
554
555
556                 /// <summary>
557                 /// This method loads all properties of the chart from a stream. By setting Content or 
558                 /// SerializableContent/NonSerializableContent properties, specific set of 
559                 /// properties can be loaded.
560                 /// </summary>
561                 /// <param name="stream">The stream to load the data from.</param>
562                 public void Load(Stream stream)
563                 {
564             //Check arguments
565             if (stream == null)
566                 throw new ArgumentNullException("stream");
567             
568             // Set serializing flag
569                         if(GetChartObject() != null)
570                         {
571                                 GetChartObject().serializing = true;
572                 GetChartObject().serializationStatus = SerializationStatus.Loading;
573                         }
574
575                         _serializer.Deserialize(GetChartObject(), stream);
576
577                         // Clear serializing flag
578                         if(GetChartObject() != null)
579                         {
580                                 GetChartObject().serializing = false;
581                 GetChartObject().serializationStatus = SerializationStatus.None;
582                         }
583                 }
584
585                 /// <summary>
586                 /// This method loads all properties of the chart from an XML reader. By setting Content or 
587                 /// SerializableContent/NonSerializableContent properties, specific set of 
588                 /// properties can be loaded.
589                 /// </summary>
590                 /// <param name="reader">The XML reader to load the data from.</param>
591                 public void Load(XmlReader reader)
592                 {
593             //Check arguments
594             if (reader == null)
595                 throw new ArgumentNullException("reader");
596
597                         // Set serializing flag
598                         if(GetChartObject() != null)
599                         {
600                                 GetChartObject().serializing = true;
601                 GetChartObject().serializationStatus = SerializationStatus.Loading;
602                         }
603
604                         _serializer.Deserialize(GetChartObject(), reader);
605
606                         // Clear serializing flag
607                         if(GetChartObject() != null)
608                         {
609                                 GetChartObject().serializing = false;
610                 GetChartObject().serializationStatus = SerializationStatus.None;
611                         }
612                 }
613
614                 /// <summary>
615                 /// This method loads all properties of the chart from the text reader. By setting Content or 
616                 /// SerializableContent/NonSerializableContent properties, specific set of 
617                 /// properties can be loaded.
618                 /// </summary>
619                 /// <param name="reader">The text reader to load the data from.</param>
620                 public void Load(TextReader reader)
621                 {
622             //Check arguments
623             if (reader == null)
624                 throw new ArgumentNullException("reader");
625
626                         // Set serializing flag
627                         if(GetChartObject() != null)
628                         {
629                                 GetChartObject().serializing = true;
630                 GetChartObject().serializationStatus = SerializationStatus.Loading;
631                         }
632
633                         _serializer.Deserialize(GetChartObject(), reader);
634
635                         // Clear serializing flag
636                         if(GetChartObject() != null)
637                         {
638                                 GetChartObject().serializing = false;
639                 GetChartObject().serializationStatus = SerializationStatus.None;
640                         }
641                 }
642
643                 #endregion
644
645                 #region Protected helper methods
646
647                 /// <summary>
648                 /// Sets SerializableContent and NonSerializableContent properties
649                 /// depending on the flags in the Content property.
650                 /// </summary>
651                 internal void SetSerializableContent()
652                 {
653                         // Reset content definition strings
654                         this.SerializableContent = "";
655                         this.NonSerializableContent = "";
656
657                         // Loop through all enumeration flags
658                         Array   enumValues = Enum.GetValues(typeof(SerializationContents ));
659                         foreach(object flagObject in enumValues)
660                         {
661                                 if(flagObject is SerializationContents )
662                                 {
663                                         // Check if flag currently set
664                                         SerializationContents   flag = (SerializationContents )flagObject;
665                                         if((this.Content & flag) == flag && 
666                                                 flag != SerializationContents .All &&
667                                                 this.Content != SerializationContents .All)
668                                         {
669                                                 // Add comma at the end of existing string
670                                                 if(this.NonSerializableContent.Length != 0)
671                                                 {
672                                                         this.NonSerializableContent += ", ";
673                                                 }
674
675                                                 // Add serializable class/properties names
676                                                 this.NonSerializableContent += GetContentString(flag, false);
677                                                 this.NonSerializableContent = this.NonSerializableContent.TrimStart(',');
678
679                                                 // Add comma at the end of existing string
680                                                 if(this.SerializableContent.Length != 0)
681                                                 {
682                                                         this.SerializableContent += ", ";
683                                                 }
684
685                                                 // Add serializable class/properties names
686                                                 this.SerializableContent += GetContentString(flag, true);
687                                                 this.SerializableContent = this.SerializableContent.TrimStart(',');
688                                         }
689                                 }
690                         }
691                 }
692
693
694                 /// <summary>
695                 /// Return a serializable or non serializable class/properties names
696                 /// for the specific flag.
697                 /// </summary>
698         /// <param name="content">Serializable content</param>
699                 /// <param name="serializable">True - get serializable string, False - non serializable.</param>
700                 /// <returns>Serializable or non serializable string with class/properties names.</returns>
701                 protected string GetContentString(SerializationContents  content, bool serializable)
702                 {
703                         switch(content)
704                         {
705                                 case(SerializationContents .All):
706                                         return "";
707                                 case(SerializationContents .Default):
708                                         return "";
709                                 case(SerializationContents .Data):
710                                         if(serializable)
711                                         {
712                                                 return  
713                                                         "Chart.BuildNumber, " +
714                                                         "Chart.Series, " +
715                                                         "Series.Points, " +
716                                                         "Series.Name, " +
717                                                         "DataPoint.XValue, " +
718                                                         "DataPoint.YValues," +
719                                                         "DataPoint.LabelStyle," +
720                                                         "DataPoint.AxisLabel," +
721                                                         "DataPoint.LabelFormat," +
722                                                         "DataPoint.IsEmpty, " +
723                                                         "Series.YValuesPerPoint, " +
724                                                         "Series.IsXValueIndexed, " + 
725                                                         "Series.XValueType, " +
726                                                         "Series.YValueType";
727                                         }
728                                         return "";
729                                 case(SerializationContents .Appearance):
730                                         if(serializable)
731                                         {
732                                                 return 
733                                                         "Chart.BuildNumber, " +
734                             "*.Name*, " +
735                             "*.Fore*, " +
736                                                         "*.Back*, " +
737                                                         "*.Border*, " +
738                                                         "*.Line*, " +
739                                                         "*.Frame*, " +
740                                                         "*.PageColor*, " +
741                                                         "*.SkinStyle*, " +
742                                                         "*.Palette, " +
743                                                         "*.PaletteCustomColors, " +
744                                                         "*.Font*, " +
745                                                         "*.*Font, " +
746                                                         "*.Color, " +
747                                                         "*.Shadow*, " +
748                                                         "*.MarkerColor, " +
749                                                         "*.MarkerStyle, " +
750                                                         "*.MarkerSize, " +
751                                                         "*.MarkerBorderColor, " +
752                                                         "*.MarkerImage, " +
753                                                         "*.MarkerImageTransparentColor, " +
754                                                         "*.LabelBackColor, " +
755                                                         "*.LabelBorder*, " +
756                                                         "*.Enable3D, " +
757                                                         "*.IsRightAngleAxes, " +
758                                                         "*.IsClustered, " +
759                                                         "*.LightStyle, " +
760                                                         "*.Perspective, " +
761                                                         "*.Inclination, " +
762                                                         "*.Rotation, " +
763                                                         "*.PointDepth, " +
764                                                         "*.PointGapDepth, " +
765                                                         "*.WallWidth";
766                                         }
767                                         return ""; 
768
769                                 default:
770                     throw (new InvalidOperationException(SR.ExceptionChartSerializerContentFlagUnsupported));
771                         }
772                 }
773
774                 /// <summary>
775                 /// Returns chart object for serialization.
776                 /// </summary>
777                 /// <returns>Chart object.</returns>
778         internal Chart GetChartObject()
779                 {
780                         if(_chart == null)
781                         {
782                                 _chart = (Chart)_serviceContainer.GetService(typeof(Chart));
783                         }
784                         return _chart;
785                 }
786
787                 #endregion
788         }
789 }