Nevron Chart


https://www.nevron.com/Forum/Topic8776.aspx
Print Topic | Close Window

By Ram Chandran - 10 Years Ago
Hi,

When i use the following code, i am getting error in two area - NTrackballTool() "The type or namespace name NTrackballTool could not be found" and chart.Dock - "Nevron.Chart.NPieChart does not contain a definition for 'Dock' and no extension method 'Dock' accepting a first argument of type 'Nevron.Chart.NPieChart' could not be found".  Please do the needful.

using System;
using System.Windows.Forms;
using Nevron.Chart;
using Nevron.Chart.WinForm;
using Nevron.GraphicsCore;
...
private void Form1_Load(object sender, EventArgs e)
{
    nChartControl1.Controller.Tools.Add(new NSelectorTool());
    nChartControl1.Controller.Tools.Add(new NTrackballTool());
    nChartControl1.Settings.JitterMode = JitterMode.Auto;
    nChartControl1.Settings.JitteringSteps = 16;
  
    NPieChart chart = new NPieChart();
    nChartControl1.Charts.Clear();
    nChartControl1.Charts.Add(chart);
    chart.Dock = DockStyle.Fill;
    chart.DockMargins = new NMarginsL(5, 5, 5, 5);
    chart.Enable3D = true;
    chart.Width = 70;
    chart.Depth = 10;
    chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveElevated);
    chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyCameraLight);
  
    NPieSeries pie = (NPieSeries)chart.Series.Add(SeriesType.Pie);
    pie.PieStyle = PieStyle.SmoothEdgeRing;
    pie.InnerRadius = new NLength(40);
    pie.PieEdgePercent = 15; 
    pie.LabelMode = PieLabelMode.SpiderNoOverlap;
  
    pie.AddDataPoint(new NDataPoint(12, "Cars"));
    pie.AddDataPoint(new NDataPoint(42, "Trains"));
    pie.AddDataPoint(new NDataPoint(56, "Airplanes"));
    pie.AddDataPoint(new NDataPoint(23, "Buses"));
    pie.AddDataPoint(new NDataPoint(32, "Bikes"));
    pie.AddDataPoint(new NDataPoint(29, "Boats"));
  
    NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.BrightMultiColor);
    styleSheet.Apply(nChartControl1.Document);
  
    nChartControl1.Refresh(); 
}

By Nevron Support - 10 Years Ago

Hi ,
Those changes are documented in the porting from 2012 guide:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This topic describes the differences in the programming model between Nevron Chart for .NET 2012.1 and Nevron Chart for .NET .
ShowInteractivity Features
All Desktop related interactivity features, such as tools, mouse events etc. are moved to the Nevron.Chart.Windows namespace. This is required because these classes are shared between the WinForm and Wpf contorls. The following code snippet shows how to port previous code to the new version:

C#

Copy Code

using Nevron.Chart.Winform;
becomes:


C#

Copy Code

using Nevron.Chart.WinForm;using Nevron.Chart.Windows;


ShowPanel Dock Property
The panel Dock property is renamed to DockMode, which accepts values from the PanelDockMode enum. This is required in order to decouple the chart DOM from the WinForms assembly. The meaning of the members of the PanelDockMode enum is the same DockStyle. The following code snippet shows how to port previous code to the new version:

C#

Copy Code

somePanel.Dock = DockStyle.Top;
becomes:

C#

Copy Code

somePanel.DockMode = PanelDockMode.Top;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Hope this helps - let us know if yoy meet any problems or have any questions.