Zoom data with image background


Author
Message
Michael Hayford
Michael Hayford
Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)Junior Member (14 reputation)
Group: Forum Members
Posts: 14, Visits: 1
I have an application where I have an image that I put on the back wall of my chart. The image is registered to the data range of the axes, i.e. the image spans data ranges of 0:1 for the x axis and 0:1 for the y axis. I would like to synchronize the data zoom capabilities of the chart with the part of the image displayed. For example, if the user zooms in to a data range of 0.4:0.6 for x and 0.3:0.7 for y, I just want to show the part of the image that falls in that range. Right now, the data and axes zoom as desired, but I see the full size of the image on the back wall.
I suspect there may be a combination of MapMode and MapLayout (plus maybe Horizontal or VerticalScale) that would allow me to do this. Is this possible?
Thanks for your help.
Mike Hayford
Reply
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

The following code demonstrates how to use a Range data series to display an image inside the chart:

using System;
using System.Windows.Forms;
using Nevron.GraphicsCore;
using Nevron.Chart;
using Nevron.Chart.WinForm;

namespace TextureMappedRange
{
 public partial class Form1 : Form
 {
  public Form1()
  {
   InitializeComponent();
  }

  private void Form1_Load(object sender, EventArgs e)
  {
   // add interactivity tools
   nChartControl1.Controller.Tools.Add(new NSelectorTool());
   nChartControl1.Controller.Tools.Add(new NAxisScrollTool());
   nChartControl1.Controller.Tools.Add(new NDataZoomTool());

   // setup chart axes
   NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0];
   chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator();
   chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true;
   chart.Axis(StandardAxis.PrimaryY).ScrollBar.Visible = true;

   // add a Range series with a single data point to display the image
   NRangeSeries range = new NRangeSeries();
   range.DataLabelStyle.Visible = false;
   range.FillStyle = new NImageFillStyle("D:\\Temp\\img\\EUROPE_map.jpg");
   range.UseXValues = true;
   range.Values.Add(10);
   range.Y2Values.Add(20);
   range.XValues.Add(1);
   range.X2Values.Add(2);
   chart.Series.Add(range);

   // add a range selection for the data zoom tool
   NRangeSelection rangeSelection = new NRangeSelection();
   chart.RangeSelections.Add(rangeSelection);
  }
 }
}



Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search