private static void CreateAxisXaml(XmlWriter writer, AxisSettings axisSettings) { writer.WriteStartElement(axisSettings.AxisType.Name, chartingNamespace); writer.WriteAttributeString("Orientation", axisSettings.Axis.Orientation.ToString()); if (axisSettings.ShowGridLines.IsChecked()) { writer.WriteAttributeString("ShowGridLines", axisSettings.ShowGridLines.IsChecked().ToString()); } if (axisSettings.AxisTitle.IsChecked) { writer.WriteAttributeString("Title", axisSettings.AxisTitle.Text); } if (axisSettings.AxisMinimum.IsChecked) { writer.WriteAttributeString("Minimum", string.Format(CultureInfo.InvariantCulture, "{0}", axisSettings.AxisMinimum.Value)); } if (axisSettings.AxisMaximum.IsChecked) { writer.WriteAttributeString("Maximum", string.Format(CultureInfo.InvariantCulture, "{0}", axisSettings.AxisMaximum.Value)); } if (axisSettings.AxisInterval.IsChecked) { writer.WriteAttributeString("Interval", string.Format(CultureInfo.InvariantCulture, "{0}", axisSettings.AxisInterval.Value)); } writer.WriteEndElement(); }
public Page() { CurrentPage = this; InitializeComponent(); _initialized = true; _xmlWriterSettings = new XmlWriterSettings(); _xmlWriterSettings.Indent = true; _xmlWriterSettings.NewLineOnAttributes = true; _xmlWriterSettings.OmitXmlDeclaration = true; for (int i = 0; i < (int)NumberOfSeries.Maximum; i++) { var seriesSettings = new SeriesSettings(); string seriesTitle = string.Format(CultureInfo.CurrentCulture, "Series {0}", i + 1); seriesSettings.SeriesTitle.Text = seriesTitle; seriesSettings.IndependentAxisSettings.AxisTitle.Text = string.Format(CultureInfo.CurrentCulture, "{0} {1}", seriesTitle, "Independent"); seriesSettings.IndependentAxisSettings.AxisAxisType.IsEnabled = false; seriesSettings.IndependentAxisSettings.AxisOrientation.IsEnabled = false; seriesSettings.DependentAxisSettings.AxisTitle.Text = string.Format(CultureInfo.CurrentCulture, "{0} {1}", seriesTitle, "Dependent"); seriesSettings.DependentAxisSettings.AxisAxisType.IsEnabled = false; seriesSettings.DependentAxisSettings.AxisOrientation.IsEnabled = false; seriesSettings.SettingsChanged += ValueChanged_UpdateChart; _seriesSettingsCollection.Add(seriesSettings); } SeriesSettingsContainer.ItemsSource = _seriesSettingsCollection; for (int i = 0; i < (int)NumberOfAxes.Maximum; i++) { var axisSettings = new AxisSettings(); axisSettings.AxisTitle.Text = string.Format(CultureInfo.CurrentCulture, "Axis {0}", i + 1); axisSettings.AxisAxisType.SelectedIndex = i % 2; axisSettings.AxisOrientation.SelectedIndex = (i + 1) % 2; axisSettings.SettingsChanged += ValueChanged_UpdateChart; _axisSettingsCollection.Add(axisSettings); } AxisSettingsContainer.ItemsSource = _axisSettingsCollection; UpdateSeriesSettings(); UpdateAxisSettings(); CreateNewChart(); var toolTip = new ToolTip(); ToolTipService.SetToolTip(AxesHeader, toolTip); toolTip.Opened += AxesHeader_ToolTip_Opened; }