Hello
I'm making a software base on CursorTrakingXY Chart
How can I make the dragfunction?
Look at the imagefile1
is it possible ?
also I want to set Chart x line zero
Look at the imagefile2
I wondring the chart api guide
Where I find the reference for chart develop
I think that the lightningchart have a many api
is it?
How can i get the manual like a msdn
Please help me and Have a nice day!
Thank you!
Making mouse drag function
Moderator: Queue Moderators
Making mouse drag function
- Attachments
-
- arction_chart2.png (22.25 KiB) Viewed 13854 times
-
- arction_chart1.png (38.93 KiB) Viewed 13854 times
- ArctionPasi
- Posts: 1367
- Joined: Tue Mar 26, 2013 10:57 pm
- Location: Finland
- Contact:
Re: Making mouse drag function
Hi Copilot,
Help resources
We have:
To format X axis labels, you can disable automatic formatting by:
_chart.ViewXY.XAxes[0].AutoFormatLabels = false;
Then set
_chart.ViewXY.XAxes[0].LabelsTimeFormat property, based on your preference. Standard .NET formatting applies there, see Double.ToString and DateTime.ToString formatting commands.
Or alternatively set FormatValueLabel event handler for the axis, and convert each value to string there.
Defining bands with mouse
Use mouse event handlers, to create a Band, and update it's ValueBegin and ValueEnd.
Like this, a Band appears in the chart when you press mouse down, band updates while you are dragging the mouse, and stops defining the Band when you release the mouse button. Is this a working solution for you?
Help resources
We have:
- User's Manual in Support http://arction.com/support. The Manual explains what kind of objects LightningChart has and describes the most important features with pictures. The manual also install in the hard drive.
- Help files (API description). You can find it in the Action program group from your start menu. It shows it in the Microsoft Help Viewer window.
- Hundreds of examples
- Forums which you are already found
- Support by e-mail, please don't hesitate to contact us
To format X axis labels, you can disable automatic formatting by:
_chart.ViewXY.XAxes[0].AutoFormatLabels = false;
Then set
_chart.ViewXY.XAxes[0].LabelsTimeFormat property, based on your preference. Standard .NET formatting applies there, see Double.ToString and DateTime.ToString formatting commands.
Or alternatively set FormatValueLabel event handler for the axis, and convert each value to string there.
Defining bands with mouse
Use mouse event handlers, to create a Band, and update it's ValueBegin and ValueEnd.
Code: Select all
//Disable zooming
_chart.ViewXY.ZoomPanOptions.LeftMouseButtonAction = MouseButtonAction.None;
//Subscribe to mouse event handlers
_chart.PreviewMouseDown += _chart_PreviewMouseDown;
_chart.PreviewMouseMove += _chart_PreviewMouseMove;
_chart.PreviewMouseUp += _chart_PreviewMouseUp;
Code: Select all
private double _bandStart = 0;
private Band _bandUnderPainting = null;
void _chart_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//Start band painting
_chart.BeginUpdate();
AxisX xAxis = _chart.ViewXY.XAxes[0];
Point mousePos = e.GetPosition(_chart);
xAxis.CoordToValue((int)mousePos.X, out _bandStart, false, true);
Band b = new Band(_chart.ViewXY, xAxis, _chart.ViewXY.YAxes[0]);
b.Binding = AxisBinding.XAxis;
b.ValueBegin = _bandStart;
b.ValueEnd = _bandStart;
b.MouseInteraction = false;
_chart.ViewXY.Bands.Add(b);
_bandUnderPainting = b;
_chart.EndUpdate();
}
void _chart_PreviewMouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
//Update band end value
if (_bandUnderPainting == null)
return;
_chart.BeginUpdate();
AxisX xAxis = _chart.ViewXY.XAxes[0];
Point mousePos = e.GetPosition(_chart);
double bandStop;
//Convert mouse position into X axis Value.
xAxis.CoordToValue((int)mousePos.X, out bandStop, false, true);
_bandUnderPainting.ValueEnd = bandStop;
_chart.EndUpdate();
}
void _chart_PreviewMouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
//Stop painting
if (_bandUnderPainting == null)
return;
_bandUnderPainting.MouseInteraction = true;
_bandUnderPainting = null;
}
LightningChart Support Team, PT
Re: Making mouse drag function
Thank you for the reply
It's so kind of you to help me.
Have a nice day !
It's so kind of you to help me.
Have a nice day !