This is a migrated thread and some comments may be shown as answers.

Horizontal trackball

3 Answers 178 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Rostik
Top achievements
Rank 1
Rostik asked on 05 Jun 2012, 02:56 PM

Hi Telerik,

I'm currently trying to achieve functionality similar to the trackball behavior, but I actually need to display a horizontal line, that crosses the given ScatterLineSeries  and starts at the corresponding vertical axis. I have to draw a slider on that axis, so I will be able to move this line by moving the slider along the axis (I've attached an image to explain what I mean).

The problem is I can't determine the position of the vertical axis during runtime to place the slider on the correct location.

I can draw the horizontal line and intersection points using another ScatterLineSeries (as was done to create an attached image), but the series cannot be drawn outside the ChartArea, so I have to extend the line to an axis programmatically.

So, is it possible to get the Y-axis coordinates inside the ChartView, or is there another way to implement the described scenario?

Thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 08 Jun 2012, 08:43 AM
Hello Rostik,

I am not sure that I understand you fully. From what I understand you want to place a slider on top of the axis. If you do this - then the axis (or some parts of it) would not be visible. Is it possible to place the slider outside the chart, just right next to it? Say, on the right hand side?

The current implementation of the Axis is Canvas-based, so it is not an easy task to determine the position of the axis and its elements. If you need further assistance you can let us know more about your scenario.

Greetings,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Rostik
Top achievements
Rank 1
answered on 12 Jun 2012, 02:11 PM

Hi Petar,

Thank you for the response.

Actually I  want to make some kind of "handle" for the  horizontal line series (this can be some UIElement, for example, an ellipse - see attachment), that user can drag up and down along the vertical axis, and the line should be moved accordingly.

As I see, to achieve the described above, I have to convert data units to physical pixels. For example, if I have a DataPoint

ScatterDataPoint p = new ScatterDataPoint() { XValue = 0, YValue = 100 };
I need to know, where inside the chart this DataPoint is.

I can get a location of this point inside RadChart using  ConvertDataUnitsToPhysical method:

double px = radChart.DefaultView.ChartArea.AxisX.ConvertDataUnitsToPhysical(p.XValue); 
double py = radChart.DefaultView.ChartArea.AxisY.ConvertDataUnitsToPhysical(p.YValue);
but that will be just location inside  the ChartArea, not the absolute location inside RadChart, and I would prefer to use ChartView instead of  Chart. 


The same problem was discussed in this thread in the RadChart section, but there wasn't any solution, so is there any such converters now, or is something similar planned for the future releases?


Thanks.



0
Petar Marchev
Telerik team
answered on 14 Jun 2012, 10:29 AM
Hello Rostik,

Yes, the RadChart supports physical to data units conversion, but the RadChartView does not. We do have plans to expose such methods in the future but I can not promise a time-frame.

For now I can only suggest that you use a slider docked next to the chart. You can link in code the value of the slider to the Y value of the line series. This is not too much of a help suggestion but keep in mind that what you are trying to achieve is not a supported scenario. Let us know if we can be of further help. 

Regars,
Petar Marchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
ChartView
Asked by
Rostik
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
Rostik
Top achievements
Rank 1
Share this question
or