I have a tchart series that contains 5000 points from a data base.
I can zoom in on a particular section of the data with the mouse.
I wish to copy only the x and y values that are visible in the subset to the clipboard (or text file).
I can easiy access the entire series, however I have not been able to figure out how to access only
the data in the zoomed rectangle.
Any help is appreciated.
Thanks in advance
Arthur
The series X index range in the zoomed rectangle is [FirstValueIndex..LastValueIndex].
Note : They are only accessible after the values are displayed.
A value of -1 means that the whole range is to be used. [0..Count-1]
Update :
And if you want to clip on Y values as well, then step through above indexes and check against leftAxis.Minimum and leftAxis.Maximum.
If you can represent any point from the series as a TPoint structure (e.g. with the help of the Point() function) and the view area as a TRect (e.g. using Rect()), you will be able to use the PtInRect() function to test whether the point is within the zoomed rectangle:
if PtInRect(ZoomedRect, ChartPoint) then ...
References:
TPoint
Point()
TRect
Rect()
PtInRect()
This was discussed here. Hope suggestions here are useful for you.
Related
I'm dealing with an application that abuses TChart with potentially hundreds of TLineSeries. I get unreadable X axis labels, because they overlap. According to this, that shouldn't happen, but it does.
I'm now looking for a way to completely disable X axis labels derived from the TLineSeries elements and only show calculated labels at regular intervals, e.g. no labels for individual data points. How would I do that?
The misbehaving application:
My failed attempt to replicate the problem:
If the Bottom Axis for the chart has a scale set with Automatic turned off (default is on) you can get overlap like that depending on your data, the desired increment and if Show all labels is checked.
However your example seems to show non-regular extra labels which might just be manually added using the Items (show in far right tab) or something else to add more axis labels.
I was finally able to reproduce the problem with a small test case. Turns out that the problem was, that the application used function TChartSeries.AddXY(Const AXValue, AYValue: TChartValue; Const ALabel: String; AColor: TColor): Integer; and provided a value for ALabel. Using only X and Y values fixed the problem.
I wanted to ask how to increase the values of the axis to display data correctly?
I tried searching the teechart options but with no luck.
In this case, you should either
use one more digit in the number format (0.0000) on the left axis, or
increase the distance between the labels on the left axis.
In a comment to the question, the OP confirmed that the number format should be changed.
To do this at runtime, you can do
MyChart.Axes.Left.AxisValuesFormat := '0.0000';
It is also possible to do this at design-time.
Posting a photo for others who might get confused where this setting can be tuned in teechart Options
Can I rotate a chart? I need x on vertical axis and y on horizontal axis.
Can I change x value to vertical axis and y value to horizontal axis?
Or can I rotate of the component TChart (xy values stay standard and I flip component 90)?
Thank you.
The easiest solution would probably be to use swap your values or add your X values as YValues and add your y values as XValues.
Ie, let's say you have your X values in an array called Xdata and your Y values in an array called Ydata. You could add your values with this:
Series1->AddXY(Ydata, Xdata);
Maybe I can write - i used a line(fast line) chart.
There
[IMG]http://i68.tinypic.com/29atrw5.png[/IMG]
is Classical graph and image if I rotate it. If I change x-y values as You wrote I get wrong image.
y = f(x) so it paint for x=1, x=2, ... but i need paint x = f(y) for y=1, y=2, y=3
I need something as is point chart - connect handly in paint
I'm not sure if it is possible change axis or rotate component teeChart.
I probably use TImage and will paint it into image.
today i find that teechart have a series "horiz line" (https://www.steema.com/files/public/teechart/java/v1/docs/Tutorials/tutorial1.htm).
But licence is expensive for our company (https://www.steema.com/buy). We need only one chart with this axes.
Do you know if can I install only some update into BCB 6?
So I have an x axis of type datetime, and a series of type column:
http://jsfiddle.net/drmrbrewer/215tnLna/3/
Now, in reality, the spacing of points on the x axis may not always be uniform as in the above example. For example, let's drop a couple of the points to create a non-uniform spacing:
http://jsfiddle.net/drmrbrewer/215tnLna/4/
What I'd like to happen is for each column to fill the entire span from the relevant point to the previous point, so that the gaps would be entirely filled in the above example.
Is that possible? Hopefully without some horrible hack? From a quick search it seems that there is a suggestion that different series may be required (one for each column width). I'm hoping that isn't the case because (a) it's complicated; and (b) I don't know in advance what spacings I'm going to encounter in the data, so it's even more complicated!
Thanks!
What you are trying to make is a histogram, not a bar chart (even bar/column widths). Perhaps you need to use the histogram chart type? https://www.highcharts.com/docs/chart-and-series-types/histogram-series
I have the following chart as an example. I would like to move the points over B such that 1% is over the orange column, and the 2% is over the blue column. Is this possible?
http://jsfiddle.net/0m3208qj/4/
code
The points are positioned according to the y value. So if you need increae position of it, you need to prepare another y values.
I managed to do this, but in a complicated way. I had to split the points into two series, use pointPlacement to move them to the correct place, and then use the renderer to draw custom lines!
Here is an example: http://jsfiddle.net/8datkr4m/
Code