Profile Picture

Moveable Line(s)

Posted By Allen Klingensmith 9 Years Ago
Author
Message
Allen Klingensmith
Question Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 7, Visits: 70

Hi,

I'm currently evaluating the Nevron Chart for .Net in a Windows Forms application.  So far, I love the product but have a question about how to best implement "Movebale Lines". 

One the same plot;
- One or more XYSeries should have "non moveable" points
- One or more XYSeriesLines should be moveable to allow the user to manually adjust them to fit portions of the data.

I have played around with the NDataPointDragTooltool and it appears the properties available to accomplish this are the "axisID's" assigned to the DragTool.  Or is there a way to associate the drag tool with the series?

Can you confirm that I'm on the right track and possibly provide an example.  Is there a better way to accomplish what I need to do?  Possibly using annotations?

I'm currently using the 2014 version of the product.

Regards,

Allen K

 



Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Allen,

The following example shows how to implement selective data point dragging. In this example the data points from the 'red' series cannot be dragged - this is achieved by creating a custom data point drag tool that overrides the CanBeginDrag method:

  class MyDataPointDragTool : NDataPointDragTool
  {
   public override bool CanBeginDrag()
   {
    ArrayList selectedDataPoints = GetSelectedDataPoints();

    if (selectedDataPoints == null)
     return false;

    foreach (NDataPoint dataPoint in selectedDataPoints)
    {
     NSeriesBase series = (NSeriesBase)dataPoint.ProvideReference(typeof(NSeriesBase));

     if ((bool)series.Tag == false)
     {
      return false;
     }
    }

    return base.CanBeginDrag();
   }
  }

  Random random = new Random();
  private void Form1_Load(object sender, EventArgs e)
  {
   NChart chart = nChartControl1.Charts[0];

   chart.Series.Add(CreatePointSeries(Color.Red, false));
   chart.Series.Add(CreatePointSeries(Color.Blue, true));

   nChartControl1.Controller.Tools.Add(new NSelectorTool());
   nChartControl1.Controller.Tools.Add(new MyDataPointDragTool());
  }

  private NPointSeries CreatePointSeries(Color color, bool draggable)
  {
   NPointSeries point = new NPointSeries();

   point.FillStyle = new NColorFillStyle(color);
   point.DataLabelStyle.Visible = false;
   point.UseXValues = true;
   point.Tag = draggable;

   for (int i = 0; i < 10; i++)
   {
    point.Values.Add(random.Next(100));
    point.XValues.Add(random.Next(100));
   }

   return point;
  }

Hope this helps - let us know if you have any questions.




Best Regards,
Nevron Support Team



Allen Klingensmith
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 7, Visits: 70

Thank you - I like your recommended solution.  It appears the Nevron Classes can be inherited and overriden which gives the user a lot of flexibility.

I also like the ability of Nevron to incorporate GDI+.

One more question, can the Nevron Chart incorporate any of the drawing functionality available in the Nevron Diagram application?

Regards,

Allen



Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Allen,

The only way to incorporate a diagram in a chart is to first rasterize the diagram in memory and then display it as some raster inside the chart. In general both controls are designed to be used separately. What is the scenario where you want to use both controls simultaneously?


Best Regards,
Nevron Support Team



Allen Klingensmith
Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 3 Years Ago
Posts: 7, Visits: 70
Good morning,

Thanks for your reply.  The scenario I had envisioned was to use the powerful classes in the Diagram tool to annotate the chart.  For instance, the ability to create a simple line or rectangle object (s) and position them programmatically on the chart. 

I am aware the Chart tool has annotation capabilities but its unclear if it is possible to create simple shapes such as a line, or a line with an arrow, etc without having to resort to using GDI+.  The compiled example shows only complex "callouts"  and looking at the programmers reference I haven't seen other "shapes".  Maybe I'm missing something.

Regards,

Allen K

Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Allen,

The annotation capabilities of the chart are poor compared to the functionality present in the diagram, as the main objective was to keep things simple in this case. You can however use the approach highlighted above - and that is to rasterize a diagram and then render it on top of the chart as an image. Let us know if you require an example on how to accomplish this.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic