Example #1
0
        public override void LoadView()
        {
            // Create a chart view that will display the chart.
            m_view = new MultipleViewsView();

            // Paste your license key here.
            m_view.view1.Chart.LicenseKey = "";
            // And here.
            m_view.view2.Chart.LicenseKey = "";

            // Create column series for the first view on the screen.
            NChartColumnSeries series1 = new NChartColumnSeries();

            series1.Brush      = new NChartSolidColorBrush(UIColor.FromRGB(97, 206, 231));
            series1.Tag        = 1;
            series1.DataSource = this;
            m_view.view1.Chart.ShouldAntialias = true;
            m_view.view1.Chart.AddSeries(series1);
            m_view.view1.Chart.UpdateData();

            // Create area series for the second view in the screen.
            NChartAreaSeries series2 = new NChartAreaSeries();

            series2.Brush      = new NChartSolidColorBrush(UIColor.FromRGB(203, 220, 56));
            series2.Tag        = 2;
            series2.DataSource = this;
            m_view.view2.Chart.ShouldAntialias = true;
            m_view.view2.Chart.AddSeries(series2);
            m_view.view2.Chart.UpdateData();

            // Set chart view to the controller.
            this.View = m_view;
        }
Example #2
0
        private void LoadViews()
        {
            // Paste your license key here.
            mNChartView1.Chart.LicenseKey = "";
            // And here.
            mNChartView2.Chart.LicenseKey = "";

            // Create column series for the first view on the screen.
            NChartColumnSeries series1 = new NChartColumnSeries();

            series1.Brush      = new NChartSolidColorBrush(Color.Argb(255, (int)(255 * 0.38), (int)(255 * 0.8), (int)(255 * 0.91)));
            series1.DataSource = this;
            series1.Tag        = 1;
            mNChartView1.Chart.ShouldAntialias = true;
            mNChartView1.Chart.AddSeries(series1);
            mNChartView1.Chart.UpdateData();

            // Create area series for the second view in the screen.
            NChartAreaSeries series2 = new NChartAreaSeries();

            series2.Brush      = new NChartSolidColorBrush(Color.Argb((int)(255 * 0.8), (int)(255 * 0.79), (int)(255 * 0.86), (int)(255 * 0.22)));
            series2.DataSource = this;
            series2.Tag        = 2;
            mNChartView2.Chart.ShouldAntialias = true;
            mNChartView2.Chart.AddSeries(series2);
            mNChartView2.Chart.UpdateData();
        }
		private void LoadViews ()
		{
			// Paste your license key here.
			mNChartView1.Chart.LicenseKey = "";
			// And here.
			mNChartView2.Chart.LicenseKey = "";

			// Create column series for the first view on the screen.
			NChartColumnSeries series1 = new NChartColumnSeries ();
			series1.Brush = new NChartSolidColorBrush (Color.Argb (255, (int)(255 * 0.38), (int)(255 * 0.8), (int)(255 * 0.91)));
			series1.DataSource = this;
			series1.Tag = 1;
			mNChartView1.Chart.ShouldAntialias = true;
			mNChartView1.Chart.AddSeries (series1);
			mNChartView1.Chart.UpdateData ();

			// Create area series for the second view in the screen.
			NChartAreaSeries series2 = new NChartAreaSeries ();
			series2.Brush = new NChartSolidColorBrush (Color.Argb ((int)(255 * 0.8), (int)(255 * 0.79), (int)(255 * 0.86), (int)(255 * 0.22)));
			series2.DataSource = this;
			series2.Tag = 2;
			mNChartView2.Chart.ShouldAntialias = true;
			mNChartView2.Chart.AddSeries (series2);
			mNChartView2.Chart.UpdateData ();
		}
		private void LoadView ()
		{
			// Paste your license key here.
			mNChartView.Chart.LicenseKey = "";

			// Margin to ensure some free space for the iOS status bar.
			mNChartView.Chart.CartesianSystem.Margin = new NChartTypes.Margin (10.0f, 10.0f, 10.0f, 20.0f);

			// Switch on antialiasing.
			mNChartView.Chart.ShouldAntialias = true;

			// Create series that will be displayed on the chart.
			NChartAreaSeries series = new NChartAreaSeries ();

			// Set brush that will fill that series with color.
			series.Brush = new NChartSolidColorBrush (Color.Argb (240, 120, 201, 242));

			// Set data source for the series.
			series.DataSource = this;

			// Set data smoother.
			series.DataSmoother = new NChartDataSmoother2D ();

			// Add series to the chart.
			mNChartView.Chart.AddSeries (series);

			// Set data source for the X-Axis to have custom values on them.
			mNChartView.Chart.CartesianSystem.XAxis.DataSource = this;

			// Update data in the chart.
			mNChartView.Chart.UpdateData ();
		}
		public override void LoadView ()
		{
			// Create a chart view that will display the chart.
			m_view = new MultipleViewsView ();

			// Paste your license key here.
			m_view.view1.Chart.LicenseKey = "";
			// And here.
			m_view.view2.Chart.LicenseKey = "";

			// Create column series for the first view on the screen.
			NChartColumnSeries series1 = new NChartColumnSeries ();
			series1.Brush = NChartSolidColorBrush.SolidColorBrushWithColor (UIColor.FromRGB (97, 206, 231));
			series1.Tag = 1;
			series1.DataSource = this;
			m_view.view1.Chart.ShouldAntialias = true;
			m_view.view1.Chart.AddSeries (series1);
			m_view.view1.Chart.UpdateData ();

			// Create area series for the second view in the screen.
			NChartAreaSeries series2 = new NChartAreaSeries ();
			series2.Brush = NChartSolidColorBrush.SolidColorBrushWithColor (UIColor.FromRGB (203, 220, 56));
			series2.Tag = 2;
			series2.DataSource = this;
			m_view.view2.Chart.ShouldAntialias = true;
			m_view.view2.Chart.AddSeries (series2);
			m_view.view2.Chart.UpdateData ();

			// Set chart view to the controller.
			this.View = m_view;
		}
Example #6
0
        private void LoadView()
        {
            // Paste your license key here.
            mNChartView.Chart.LicenseKey = "";

            // Margin to ensure some free space for the iOS status bar.
            mNChartView.Chart.CartesianSystem.Margin = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f);

            // Switch on antialiasing.
            mNChartView.Chart.ShouldAntialias = true;

            // Array of colors for the series.
            float[,] colors = new float[, ] {
                { 0.38f, 0.8f, 0.91f },
                { 0.2f, 0.86f, 0.22f },
                { 0.9f, 0.29f, 0.51f }
            };

            // Create column series.
            NChartColumnSeries series1 = new NChartColumnSeries();

            series1.Brush = new NChartSolidColorBrush(Color.Argb(255,
                                                                 (int)(255 * colors[0, 0]),
                                                                 (int)(255 * colors[0, 1]),
                                                                 (int)(255 * colors[0, 2])));
            series1.DataSource = this;
            series1.Tag        = 0;
            mNChartView.Chart.AddSeries(series1);

            // Create area series.
            NChartAreaSeries series2 = new NChartAreaSeries();

            series2.Brush = new NChartSolidColorBrush(Color.Argb(255,
                                                                 (int)(255 * colors[1, 0]),
                                                                 (int)(255 * colors[1, 1]),
                                                                 (int)(255 * colors[1, 2])));
            series2.DataSource = this;
            series2.Tag        = 1;
            mNChartView.Chart.AddSeries(series2);

            // Create line series.
            NChartLineSeries series3 = new NChartLineSeries();

            series3.Brush = new NChartSolidColorBrush(Color.Argb(255,
                                                                 (int)(255 * colors[2, 0]),
                                                                 (int)(255 * colors[2, 1]),
                                                                 (int)(255 * colors[2, 2])));
            series3.LineThickness = 3.0f;
            series3.DataSource    = this;
            series3.Tag           = 2;
            mNChartView.Chart.AddSeries(series3);

            // Set data source for the X-Axis to have custom values on them.
            mNChartView.Chart.CartesianSystem.XAxis.DataSource = this;

            // Update data in the chart.
            mNChartView.Chart.UpdateData();
        }
        public override void LoadView()
        {
            // Create a chart view that will display the chart.
            m_view = new NChartView();

            // Paste your license key here.
            m_view.Chart.LicenseKey = "";

            // Margin to ensure some free space for the iOS status bar.
            m_view.Chart.CartesianSystem.Margin = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f);

            // Create series that will be displayed on the chart.
            NChartAreaSeries series = new NChartAreaSeries();

            // Set brush that will fill that series with color.
            series.Brush = new NChartSolidColorBrush(UIColor.FromRGB(97, 206, 231));

            // Set data source for the series.
            series.DataSource = this;

            // Add series to the chart.
            m_view.Chart.AddSeries(series);

            // Create crosshair.
            NChartCrosshair cs = new NChartCrosshair();

            // Set color for crosshair's haris.
            cs.XHair.SetColor(UIColor.FromRGB(255, 0, 0));
            cs.YHair.SetColor(UIColor.FromRGB(0, 0, 255));

            // Set thickness for crosshair's hairs.
            cs.Thickness = 2.0f;

            // Set value for crosshair. Alternatively it's possible to create crosshair connected to chart point using the method
            // new NChartCrosshair (Color color, float thickness, NChartPoint targetPoint);
            cs.XHair.Value = 5.25;
            cs.YHair.Value = 13.0;

            // Set crosshair delegate to handle moving.
            cs.Delegate = this;

            // Set crosshair snapping to X-Axis ticks.
            cs.XHair.SnapToMinorTicks = true;
            cs.XHair.SnapToMajorTicks = true;

            // Add tooltip to the hair parallel to Y-Axis.
            cs.XHair.Tooltip = CreateTooltip();
            UpdateTooltipText(cs.XHair.Tooltip, cs.XHair.Value);

            // Add crosshair to the chart's coordinate system.
            m_view.Chart.CartesianSystem.AddCrosshair(cs);

            // Update data in the chart.
            m_view.Chart.UpdateData();

            // Set chart view to the controller.
            this.View = m_view;
        }
		private void LoadView ()
		{
			// Paste your license key here.
			mNChartView.Chart.LicenseKey = "";

			// Margin to ensure some free space for the iOS status bar.
			mNChartView.Chart.CartesianSystem.Margin = new NChartTypes.Margin (10.0f, 10.0f, 10.0f, 20.0f);

			// Switch on antialiasing.
			mNChartView.Chart.ShouldAntialias = true;

			// Array of colors for the series.
			float[,] colors = new float[,] {
				{ 0.38f, 0.8f, 0.91f },
				{ 0.2f, 0.86f, 0.22f },
				{ 0.9f, 0.29f, 0.51f }
			};

			// Create column series.
			NChartColumnSeries series1 = new NChartColumnSeries ();
			series1.Brush = new NChartSolidColorBrush (Color.Argb (255, 
				(int)(255 * colors [0, 0]),
				(int)(255 * colors [0, 1]),
				(int)(255 * colors [0, 2])));
			series1.DataSource = this;
			series1.Tag = 0;
			mNChartView.Chart.AddSeries (series1);

			// Create area series.
			NChartAreaSeries series2 = new NChartAreaSeries ();
			series2.Brush = new NChartSolidColorBrush (Color.Argb (255, 
				(int)(255 * colors [1, 0]),
				(int)(255 * colors [1, 1]),
				(int)(255 * colors [1, 2])));
			series2.DataSource = this;
			series2.Tag = 1;
			mNChartView.Chart.AddSeries (series2);

			// Create line series.
			NChartLineSeries series3 = new NChartLineSeries ();
			series3.Brush = new NChartSolidColorBrush (Color.Argb (255, 
				(int)(255 * colors [2, 0]),
				(int)(255 * colors [2, 1]),
				(int)(255 * colors [2, 2])));
			series3.LineThickness = 3.0f;
			series3.DataSource = this;
			series3.Tag = 2;
			mNChartView.Chart.AddSeries (series3);

			// Set data source for the X-Axis to have custom values on them.
			mNChartView.Chart.CartesianSystem.XAxis.DataSource = this;

			// Update data in the chart.
			mNChartView.Chart.UpdateData ();
		}
Example #9
0
        void CreateSeries()
        {
            NChartAreaSeries series = new NChartAreaSeries();

            series.DataSource = this;
            series.Tag        = 0;
            series.Brush      = new NChartSolidColorBrush(Color.Argb(255, (int)(0.38 * 255), (int)(0.8 * 255), (int)(0.91 * 255)));
            mNChartView.Chart.AddSeries(series);

            mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
            mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
            mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
        }
Example #10
0
        private void LoadView()
        {
            // Paste your license key here.
            mNChartView.Chart.LicenseKey = "";

            // Margin to ensure some free space for the iOS status bar.
            mNChartView.Chart.CartesianSystem.Margin = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f);

            // Create area series with colors and add them to the chart.
            NChartAreaSeries series = new NChartAreaSeries();

            series.Brush      = new NChartSolidColorBrush(Color.Argb(255, 97, 205, 232));
            series.DataSource = this;
            mNChartView.Chart.AddSeries(series);

            // Create crosshair.
            NChartCrosshair cs = new NChartCrosshair();

            // Set color for crosshair's haris.
            cs.XHair.SetColor(Color.Argb(255, 255, 0, 0));
            cs.YHair.SetColor(Color.Argb(255, 0, 0, 255));

            // Set thickness for crosshair's hairs.
            cs.Thickness = 2.0f;

            // Set value for crosshair. Alternatively it's possible to create crosshair connected to chart point using the method
            // new NChartCrosshair (Color color, float thickness, NChartPoint targetPoint);
            cs.XHair.Value = 5.25;
            cs.YHair.Value = 13.0;

            // Set crosshair delegate to handle moving.
            cs.Delegate = this;

            // Set crosshair snapping to X-Axis ticks.
            cs.XHair.SnapToMinorTicks = true;
            cs.XHair.SnapToMajorTicks = true;

            // Add tooltip to the hair parallel to Y-Axis.
            cs.XHair.Tooltip = CreateTooltip();
            UpdateTooltipText(cs.XHair.Tooltip, cs.XHair.Value);

            // Add crosshair to the chart's coordinate system.
            mNChartView.Chart.CartesianSystem.AddCrosshair(cs);

            // Update data in the chart.
            mNChartView.Chart.UpdateData();
        }
Example #11
0
        public override void LoadView()
        {
            // Create a chart view that will display the chart.
            m_view = new NChartView();

            // Paste your license key here.
            m_view.Chart.LicenseKey = "";

            // Switch on antialiasing.
            m_view.Chart.ShouldAntialias = true;

            if (drawIn3D)
            {
                // Switch 3D on.
                m_view.Chart.DrawIn3D = true;
                // Margin to ensure some free space for the iOS status bar and Y-Axis tick titles.
                m_view.Chart.CartesianSystem.Margin = new NChartMargin(50.0f, 50.0f, 10.0f, 20.0f);
                m_view.Chart.PolarSystem.Margin     = new NChartMargin(50.0f, 50.0f, 10.0f, 20.0f);
            }
            else
            {
                // Margin to ensure some free space for the iOS status bar.
                m_view.Chart.CartesianSystem.Margin = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f);
                m_view.Chart.PolarSystem.Margin     = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f);
            }

            // Create series that will be displayed on the chart.
            NChartAreaSeries series = new NChartAreaSeries();

            series.DataSource    = this;
            series.Tag           = 0;
            series.Brush         = new NChartSolidColorBrush(UIColor.FromRGB(97, 206, 231));
            series.Brush.Opacity = m_view.Chart.DrawIn3D ? 1.0f : 0.8f;
            m_view.Chart.AddSeries(series);

            m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
            m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
            m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;

            // Update data in the chart.
            m_view.Chart.UpdateData();

            // Set chart view to the controller.
            this.View = m_view;
        }
		public override void LoadView ()
		{
			// Create a chart view that will display the chart.
			m_view = new NChartView ();

			// Paste your license key here.
			m_view.Chart.LicenseKey = "";

			// Switch on antialiasing.
			m_view.Chart.ShouldAntialias = true;

			// Margin to ensure some free space for the iOS status bar.
			m_view.Chart.CartesianSystem.Margin = new NChartMargin (10.0f, 10.0f, 10.0f, 20.0f);

			// Set data source for X-Axis.
			m_view.Chart.CartesianSystem.XAxis.DataSource = this;

			// Create series that will be displayed on the chart.
			NChartAreaSeries series = new NChartAreaSeries ();

			// Set brush that will fill that series with color.
			series.Brush = NChartSolidColorBrush.SolidColorBrushWithColor (UIColor.FromRGBA (0.38f, 0.8f, 0.91f, 0.9f));

			// Set data source for the series.
			series.DataSource = this;

			// Set data smoother.
			series.DataSmoother = NChartDataSmoother2D.DataSmoother;

			// Add series to the chart.
			m_view.Chart.AddSeries (series);

			// Update data in the chart.
			m_view.Chart.UpdateData ();

			// Set chart view to the controller.
			this.View = m_view;

			// Uncomment this line to get the animated transition.
			//m_view.Chart.PlayTransition(1.0f, false);
		}
		void CreateSeries ()
		{
			// Create series.
			switch (type) {
			case SeriesType.Column2D:
			case SeriesType.Column3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartColumnSeries series = new NChartColumnSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					NChartColumnSeriesSettings settings = new NChartColumnSeriesSettings ();
					settings.CylindersResolution = 4;
					settings.ShouldSmoothCylinders = false;
					m_view.Chart.AddSeriesSettings (settings);
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.ColumnCylinder:
				{
					for (int i = 0; i < 3; ++i) {
						NChartColumnSeries series = new NChartColumnSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					NChartColumnSeriesSettings settings = new NChartColumnSeriesSettings ();
					settings.CylindersResolution = 20;
					settings.ShouldSmoothCylinders = true;
					m_view.Chart.AddSeriesSettings (settings);
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Bar2D:
			case SeriesType.Bar3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartBarSeries series = new NChartBarSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					NChartBarSeriesSettings settings = new NChartBarSeriesSettings ();
					settings.CylindersResolution = 4;
					settings.ShouldSmoothCylinders = false;
					m_view.Chart.AddSeriesSettings (settings);
					m_view.Chart.CartesianSystem.XAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.BarCylinder:
				{
					for (int i = 0; i < 3; ++i) {
						NChartBarSeries series = new NChartBarSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					NChartBarSeriesSettings settings = new NChartBarSeriesSettings ();
					settings.CylindersResolution = 20;
					settings.ShouldSmoothCylinders = true;
					m_view.Chart.AddSeriesSettings (settings);
					m_view.Chart.CartesianSystem.XAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Area2D:
			case SeriesType.Area3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartAreaSeries series = new NChartAreaSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						series.Brush.Opacity = m_view.Chart.DrawIn3D ? 1.0f : 0.8f;
						m_view.Chart.AddSeries (series);
					}
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Line2D:
			case SeriesType.Line3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartLineSeries series = new NChartLineSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						series.LineThickness = 3.0f;
						m_view.Chart.AddSeries (series);
					}
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Step2D:
			case SeriesType.Step3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartStepSeries series = new NChartStepSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						series.LineThickness = 3.0f;
						m_view.Chart.AddSeries (series);
					}
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Ribbon:
				{
					for (int i = 0; i < 3; ++i) {
						NChartRibbonSeries series = new NChartRibbonSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Pie2D:
			case SeriesType.Pie3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartPieSeries series = new NChartPieSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					NChartPieSeriesSettings settings = new NChartPieSeriesSettings ();
					settings.HoleRatio = 0.0f;
					m_view.Chart.AddSeriesSettings (settings);
				}
				break;

			case SeriesType.Doughnut2D:
			case SeriesType.Doughnut3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartPieSeries series = new NChartPieSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}
					NChartPieSeriesSettings settings = new NChartPieSeriesSettings ();
					settings.HoleRatio = 0.1f;
					m_view.Chart.AddSeriesSettings (settings);
				}
				break;

			case SeriesType.Bubble2D:
			case SeriesType.Bubble3D:
			case SeriesType.Scatter2D:
			case SeriesType.Scatter3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartBubbleSeries series = new NChartBubbleSeries ();
						series.DataSource = this;
						series.Tag = i;
						m_view.Chart.AddSeries (series);
					}
					m_view.Chart.CartesianSystem.XAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = false;
				}
				break;

			case SeriesType.Surface:
				{
					NChartSurfaceSeries series = new NChartSurfaceSeries ();
					series.DataSource = this;
					series.Tag = 0;
					m_view.Chart.AddSeries (series);

					m_view.Chart.CartesianSystem.XAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = false;
				}
				break;

			case SeriesType.Candlestick2D:
			case SeriesType.Candlestick3D:
				{
					NChartCandlestickSeries series = new NChartCandlestickSeries ();
					series.DataSource = this;
					series.Tag = 0;
					series.PositiveColor = UIColor.FromRGB (73, 226, 141);
					series.PositiveBorderColor = UIColor.FromRGB (65, 204, 38);
					series.NegativeColor = UIColor.FromRGB (221, 73, 73);
					series.NegativeBorderColor = UIColor.FromRGB (199, 15, 50);
					series.BorderThickness = 3.0f;
					m_view.Chart.AddSeries (series);

					NChartCandlestickSeriesSettings settings = new NChartCandlestickSeriesSettings ();
					settings.CylindersResolution = 20;
					m_view.Chart.AddSeriesSettings (settings);
					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.OHLC2D:
			case SeriesType.OHLC3D:
				{
					NChartOHLCSeries series = new NChartOHLCSeries ();
					series.DataSource = this;
					series.Tag = 0;
					series.PositiveColor = UIColor.FromRGB (73, 226, 141);
					series.NegativeColor = UIColor.FromRGB (221, 73, 73);
					series.BorderThickness = 1.0f;
					m_view.Chart.AddSeries (series);

					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Band:
				{
					NChartBandSeries series = new NChartBandSeries ();
					series.DataSource = this;
					series.Tag = 0;
					series.PositiveColor = UIColor.FromRGBA (112, 170, 242, 204);
					series.NegativeColor = UIColor.FromRGBA (196, 240, 91, 204);
					series.HighBorderColor = UIColor.FromRGB (130, 196, 255);
					series.LowBorderColor = UIColor.FromRGB (226, 255, 112);
					series.BorderThickness = 5.0f;
					m_view.Chart.AddSeries (series);

					m_view.Chart.CartesianSystem.XAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Sequence:
				{
					for (int i = 0; i < 3; ++i) {
						NChartSequenceSeries series = new NChartSequenceSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						m_view.Chart.AddSeries (series);
					}

					m_view.Chart.CartesianSystem.XAxis.HasOffset = false;
					m_view.Chart.CartesianSystem.YAxis.HasOffset = true;
					m_view.Chart.CartesianSystem.ZAxis.HasOffset = false;
				}
				break;

			case SeriesType.Radar:
				{
					for (int i = 0; i < 3; ++i) {
						NChartRadarSeries series = new NChartRadarSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						series.Brush.Opacity = 0.8f;
						m_view.Chart.AddSeries (series);
					}
				}
				break;

			case SeriesType.Funnel2D:
			case SeriesType.Funnel3D:
				for (int i = 0; i < 3; ++i) {
					NChartFunnelSeries series = new NChartFunnelSeries ();
					series.DataSource = this;
					series.Tag = i;
					series.BottomRadius = (float)(i + 1) / 5.0f;
					series.TopRadius = (float)(i + 2) / 5.0f;
					NChartBrush brush = brushes [i];
					brush.Opacity = 0.8f;
					series.Brush = brush;
					m_view.Chart.AddSeries (series);
				}
				m_view.Chart.CartesianSystem.Visible = false;
				break;

			case SeriesType.Heatmap:
				{
					NChartHeatmapSeries series = new NChartHeatmapSeries ();
					series.DataSource = this;
					series.Tag = 0;

					// Create brush scale.
					// See NChartBrushScale for details.
					series.Scale = NChartBrushScale.BrushScaleWithBrushes (brushes, new NSNumber[] {
						NSNumber.FromDouble (-0.3),
						NSNumber.FromDouble (0.3)
					});

					m_view.Chart.AddSeries (series);
					m_view.Chart.CartesianSystem.XAxis.ShouldBeautifyMinAndMax = false;
					m_view.Chart.CartesianSystem.YAxis.ShouldBeautifyMinAndMax = false;
				}
				break;
			}
		}
Example #14
0
        public override void LoadView()
        {
            // Create a chart view that will display the chart.
            m_view = new NChartView();

            // Paste your license key here.
            m_view.Chart.LicenseKey = "";

            // Switch on antialiasing.
            m_view.Chart.ShouldAntialias = true;

            // Margin to ensure some free space for the iOS status bar.
            m_view.Chart.CartesianSystem.Margin = new NChartMargin(10.0f, 10.0f, 10.0f, 20.0f);

            // Array of colors for the series.
            int[,] colors = new int[3, 3] {
                { 97, 206, 231 },
                { 203, 220, 56 },
                { 229, 74, 131 }
            };

            // Create column series.
            NChartColumnSeries series1 = new NChartColumnSeries();

            series1.Brush = new NChartSolidColorBrush(UIColor.FromRGB(
                                                          colors[0, 0],
                                                          colors[0, 1],
                                                          colors[0, 2]
                                                          ));
            series1.DataSource = this;
            series1.Tag        = 0;
            m_view.Chart.AddSeries(series1);

            // Create area series.
            NChartAreaSeries series2 = new NChartAreaSeries();

            series2.Brush = new NChartSolidColorBrush(UIColor.FromRGBA(
                                                          colors[1, 0],
                                                          colors[1, 1],
                                                          colors[1, 2],
                                                          180
                                                          ));
            series2.DataSource = this;
            series2.Tag        = 1;
            m_view.Chart.AddSeries(series2);

            // Create line series.
            NChartLineSeries series3 = new NChartLineSeries();

            series3.Brush = new NChartSolidColorBrush(UIColor.FromRGB(
                                                          colors[2, 0],
                                                          colors[2, 1],
                                                          colors[2, 2]
                                                          ));
            series3.LineThickness = 3.0f;
            series3.DataSource    = this;
            series3.Tag           = 2;
            m_view.Chart.AddSeries(series3);

            // Set data source for the X-Axis to have custom values on them.
            m_view.Chart.CartesianSystem.XAxis.DataSource = this;

            // Update data in the chart.
            m_view.Chart.UpdateData();

            // Set chart view to the controller.
            this.View = m_view;
        }
Example #15
0
		void CreateSeries ()
		{
			// Create series.
			switch (type) {
			case SeriesType.Column2D:
			case SeriesType.Column3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartColumnSeries series = new NChartColumnSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					NChartColumnSeries.Settings settings = new NChartColumnSeries.Settings ();
					settings.CylindersResolution = 4;
					settings.ShouldSmoothCylinders = false;
					mNChartView.Chart.AddSeriesSettings (settings);
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.ColumnCylinder:
				{
					for (int i = 0; i < 3; ++i) {
						NChartColumnSeries series = new NChartColumnSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					NChartColumnSeries.Settings settings = new NChartColumnSeries.Settings ();
					settings.CylindersResolution = 20;
					settings.ShouldSmoothCylinders = false;
					mNChartView.Chart.AddSeriesSettings (settings);
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Bar2D:
			case SeriesType.Bar3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartBarSeries series = new NChartBarSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					NChartBarSeries.Settings settings = new NChartBarSeries.Settings ();
					settings.CylindersResolution = 4;
					settings.ShouldSmoothCylinders = false;
					mNChartView.Chart.AddSeriesSettings (settings);
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.BarCylinder:
				{
					for (int i = 0; i < 3; ++i) {
						NChartBarSeries series = new NChartBarSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					NChartBarSeries.Settings settings = new NChartBarSeries.Settings ();
					settings.CylindersResolution = 20;
					settings.ShouldSmoothCylinders = false;
					mNChartView.Chart.AddSeriesSettings (settings);
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Area2D:
			case SeriesType.Area3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartAreaSeries series = new NChartAreaSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Line2D:
			case SeriesType.Line3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartLineSeries series = new NChartLineSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						series.LineThickness = 3.0f;
						mNChartView.Chart.AddSeries (series);
					}
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Step2D:
			case SeriesType.Step3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartStepSeries series = new NChartStepSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						series.LineThickness = 3.0f;
						mNChartView.Chart.AddSeries (series);
					}
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Ribbon:
				{
					for (int i = 0; i < 3; ++i) {
						NChartRibbonSeries series = new NChartRibbonSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Pie2D:
			case SeriesType.Pie3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartPieSeries series = new NChartPieSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					NChartPieSeries.Settings settings = new NChartPieSeries.Settings ();
					settings.HoleRatio = 0.0f;
					mNChartView.Chart.AddSeriesSettings (settings);
				}
				break;

			case SeriesType.Doughnut2D:
			case SeriesType.Doughnut3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartPieSeries series = new NChartPieSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i];
						mNChartView.Chart.AddSeries (series);
					}
					NChartPieSeries.Settings settings = new NChartPieSeries.Settings ();
					settings.HoleRatio = 0.1f;
					mNChartView.Chart.AddSeriesSettings (settings);
				}
				break;

			case SeriesType.Bubble2D:
			case SeriesType.Bubble3D:
			case SeriesType.Scatter2D:
			case SeriesType.Scatter3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartBubbleSeries series = new NChartBubbleSeries ();
						series.DataSource = this;
						series.Tag = i;
						mNChartView.Chart.AddSeries (series);
					}
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = false;
				}
				break;

			case SeriesType.Surface:
				{
					NChartSurfaceSeries series = new NChartSurfaceSeries ();
					series.DataSource = this;
					series.Tag = 0;
					mNChartView.Chart.AddSeries (series);

					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = false;
				}
				break;

			case SeriesType.Candlestick2D:
			case SeriesType.Candlestick3D:
				{
					NChartCandlestickSeries series = new NChartCandlestickSeries ();
					series.DataSource = this;
					series.Tag = 0;
					series.PositiveColor = Color.Argb (255, (int)(255 * 0.28), (int)(255 * 0.88), (int)(255 * 0.55));
					series.PositiveBorderColor = Color.Argb (255, (int)(255 * 0.25), (int)(255 * 0.8), (int)(255 * 0.15));
					series.NegativeColor = Color.Argb (255, (int)(255 * 0.87), (int)(255 * 0.28), (int)(255 * 0.28));
					series.NegativeBorderColor = Color.Argb (255, (int)(255 * 0.78), (int)(255 * 0.1), (int)(255 * 0.2));
					series.BorderThickness = 3.0f;
					mNChartView.Chart.AddSeries (series);

					NChartCandlestickSeries.Settings settings = new NChartCandlestickSeries.Settings ();
					settings.CylindersResolution = 20;
					mNChartView.Chart.AddSeriesSettings (settings);
					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.OHLC2D:
			case SeriesType.OHLC3D:
				{
					NChartOHLCSeries series = new NChartOHLCSeries ();
					series.DataSource = this;
					series.Tag = 0;
					series.PositiveColor = Color.Argb (255, (int)(255 * 0.28), (int)(255 * 0.88), (int)(255 * 0.55));
					series.NegativeColor = Color.Argb (255, (int)(255 * 0.87), (int)(255 * 0.28), (int)(255 * 0.28));
					series.BorderThickness = 3.0f;
					mNChartView.Chart.AddSeries (series);

					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Band:
				{
					NChartBandSeries series = new NChartBandSeries ();
					series.DataSource = this;
					series.Tag = 0;
					series.PositiveColor = Color.Argb ((int)(255 * 0.8), (int)(255 * 0.41), (int)(255 * 0.67), (int)(255 * 0.95));
					series.NegativeColor = Color.Argb ((int)(255 * 0.8), (int)(255 * 0.77), (int)(255 * 0.94), (int)(255 * 0.36));
					series.HighBorderColor = Color.Argb ((int)(255 * 0.8), (int)(255 * 0.51), (int)(255 * 0.78), (int)(255 * 1.0));
					series.LowBorderColor = Color.Argb ((int)(255 * 0.8), (int)(255 * 0.89), (int)(255 * 1.0), (int)(255 * 0.44));

					series.BorderThickness = 5.0f;
					mNChartView.Chart.AddSeries (series);

					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = true;
				}
				break;

			case SeriesType.Sequence:
				{
					for (int i = 0, m = 3; i < m; ++i) {
						NChartSequenceSeries series = new NChartSequenceSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.Brush = brushes [i % brushes.Length];
						mNChartView.Chart.AddSeries (series);
					}

					mNChartView.Chart.CartesianSystem.XAxis.HasOffset = false;
					mNChartView.Chart.CartesianSystem.YAxis.HasOffset = true;
					mNChartView.Chart.CartesianSystem.ZAxis.HasOffset = false;
				}
				break;

			case SeriesType.Radar:
				{
					for (int i = 0; i < 3; ++i) {
						NChartRadarSeries series = new NChartRadarSeries ();
						series.DataSource = this;
						series.Tag = i;
						NChartBrush brush = brushes [i % brushes.Length]; // todo: copy method here
						brush.Opacity = 0.8;
						series.Brush = brush;
						mNChartView.Chart.AddSeries (series);
					}
				}
				break;

			case SeriesType.Funnel2D:
			case SeriesType.Funnel3D:
				{
					for (int i = 0; i < 3; ++i) {
						NChartFunnelSeries series = new NChartFunnelSeries ();
						series.DataSource = this;
						series.Tag = i;
						series.BottomRadius = (float)(i + 1) / 5.0f;
						series.TopRadius = (float)(i + 2) / 5.0f;
						NChartBrush brush = brushes [i % brushes.Length];
						brush.Opacity = 0.8f;
						series.Brush = brush;
						mNChartView.Chart.AddSeries (series);
					}
				}
				break;

			case SeriesType.Heatmap:
				{
					NChartHeatmapSeries series = new NChartHeatmapSeries ();
					series.DataSource = this;
					series.Tag = 0;

					// Create brush scale.
					// See NChartBrushScale for details.
					series.Scale = new NChartBrushScale (brushes, new Number[] { (Number)(-0.3), (Number)(0.3) });

					mNChartView.Chart.AddSeries (series);
					mNChartView.Chart.CartesianSystem.XAxis.ShouldBeautifyMinAndMax = false;
					mNChartView.Chart.CartesianSystem.YAxis.ShouldBeautifyMinAndMax = false;
				}
				break;
			}
		}