Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
custom layer not working..
posted

Hi,

i created a custom layer and i am adding a polyline to custom layer but it doesn't seems to work.

 Custom Layer Code

public void FillSceneGraph(SceneGraph scene)

{

if (Grid.Count == 0)

return;

IAdvanceAxis xAxis = Grid["X"] as IAdvanceAxis;

IAdvanceAxis yAxis = Grid["Y"] as IAdvanceAxis;

Polyline myPolyLine = null;

List<DataPoint> lsNewPoints = new List<DataPoint>();

int[ points = new [{5, 15, 25, 35, 45};foreach (int val in points)

{

int x = (int)(double)yAxis.MapInverse(val);

int y = (int)(double)yAxis.MapInverse(val);

DataPoint newPoint = new DataPoint(x, y);

lsNewPoints.Add(newPoint);

scene.Add(newPoint);

}

myPolyLine =
new Polyline(lsNewPoints.ToArray());myPolyLine.PE.Stroke = Color.Blue;

myPolyLine.PE.StrokeWidth = 2;

scene.Add(myPolyLine);

Main Chart Code

private void Form4_Load(object sender, EventArgs e)

{

DataTable dt = new DataTable();

dt.Columns.Add("First", typeof(double));

dt.Columns.Add("Second", typeof(double));

dt.Rows.Add(1, 1);

dt.Rows.Add(10, 10);

dt.Rows.Add(20, 20);

dt.Rows.Add(30, 30);

dt.Rows.Add(40, 40);

dt.Rows.Add(50, 50);

 

ultraChart1.ChartType =
ChartType.ScatterChart;

ultraChart1.ScatterChart.ColumnX = 1;

ultraChart1.ScatterChart.ColumnY = 0;

ultraChart1.ScatterChart.ConnectWithLines =
true;

ultraChart1.DataSource = dt;

ultraChart1.Layer[
"CustomLayer"] = new CustomLayer();ultraChart1.UserLayerIndex = new string[ {"Default", "CustomLayer"};

ultraChart1.InvalidateLayers();

 

}

I am  not sure why custom layer is not adding the polyline..

It would be helpful if any one can point me in right direction... Let me know if you need more info...

Thanks,

KK

Parents
No Data
Reply
  • 28496
    Offline posted

    check the actual points you are passing into that line and see if they would fit on the chart.  i think you should be using the axis.Map function instead of MapInverse.

Children
No Data