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 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(); }
public void DidEndMoving(NChartCrosshair crosshair) { UpdateTooltipText(crosshair.XHair.Tooltip, crosshair.XHair.Value); }
public void DidBeginMoving(NChartCrosshair crosshair) { }