First post here but been here 1000 times, really like the contribution from other members.
I know many of you will roll your eyes but I don’t have a lot to start with.
I have moderate understanding of c#, basic of MS C and somewhat more of Microchip C and ASM.
Trying to make an app for WinCE6 as a home automation main controller, have most of my module working and no is time to put the pieces together, Have a SQLCE database with 50 column and 1440 rows, that is for 50 device and 1440 minute for 1 day, all control’s will repeat their function every day. The database currently populated with random data for testing, now I want to create a visual control to create data, cant find CE version of MSChart control so I decided to make a x86 app where I can create my data. My difficulty mainly comes from inexperience, I can add or insert point to the Series but they will not insert in the order I want it to.
In this examples you can see what I would like to achieve;
1 no data point all 1440 record will have the same value.
2 added points to 200,400,600,800,1000,1100.
3 moved point at 400 on Y from270 to 350.
4 deleted point at 200,400,600,800.
Open to all suggestion.
Cant upload pictures so please follow the links.
Thanks
imgur.com/zsBla.jpg
imgur.com/y4wsn.jpg
imgur.com/Yo4XH.jpg
imgur.com/7FgHn.jpg
private void chart1_MouseClick(object sender, MouseEventArgs e)
{
var pos = e.Location;
clickPosition = pos;
var results = chart1.HitTest(pos.X, pos.Y, false, ChartElementType.PlottingArea);
foreach (var result in results)
{
if (result.ChartElementType == ChartElementType.PlottingArea)
{
var xVal = result.ChartArea.AxisX.PixelPositionToValue(pos.X);
var yVal = result.ChartArea.AxisY.PixelPositionToValue(pos.Y);
//tooltip.Show("x=" + xVal + ", y=" + yVal, this.chart1, e.Location.X, e.Location.Y - 15);
tk++;
chart1.Series[0].Points.InsertXY (0,tk,yVal);
//chart1.Series[0].Sort(PointSortOrder.Ascending);//.Points.InsertXY(0,xVal, yVal);
Tick.Text = tk.ToString();
}
}
}
Elcast, looking over your issue it looks like your real problem is that you want your data to be “one-to-one”, and you almost get it with your sorted data, but probably the actual problem is how you are sorting the data.
I put together a quick demo which I hope will help solve your problem:
Which gives this (Left: Sorted, Right: Unsorted)
