I have an application to show points of a table of values (x, y) in a polilinea
, for this I use a canvas
and a pointcollection
My question is if I can make the separation between the points bigger
I explain myself with an image:
Polyline polilinea2 = new Polyline();
PointCollection puntos2 = new PointCollection();
xrealmin = -200; xrealmax = 200; yrealmin = -200; yrealmax = 200;
xpantmin = 0; xpantmax = grafica.ActualWidth; ypantmin = 0; ypantmax = grafica.ActualHeight;
polilinea2.Stroke = Brushes.Red;
if (e.aux == 1)
{
grafica.Children.Clear();
ejes();
}
dibujar(polilinea2, puntos2, e.hojas, e.selected);
grafica.Children.Add(polilinea2);
public Point escalar(int x, int y)
{
xreal = x;
yreal = y;
xpant = ((xpantmax - xpantmin) * (xreal - xrealmin) / (xrealmax - xrealmin) + xpantmin)+10;
ypant = (ypantmin - ypantmax) * (yreal - yrealmin) / (yrealmax - yrealmin) + ypantmax;
Point p = new Point(xpant, ypant);
return p;
}
public void dibujar(Polyline p, PointCollection pc, List<Hojas> h, int selected)
{
//MessageBox.Show(selected.ToString());
if (selected!=-1 && h.Count>0 && h[selected].lp.Count>0)
{
for (int i = 0; i < h[selected].lp.Count; i++)
{
pc.Add(escalar(h[selected].lp[i].x, h[selected].lp[i].y));
}
p.Points = pc;
nHoja.Content = h[selected].name;
}
}