Page 1 of 1

Drawing series without Y axis

Posted: Thu Mar 24, 2011 9:19 pm
by 10548769
I would like to know if there is a way to draw series without an Y series. That series should be align with the pixel of the chartrect or a ratio of it.

Why i need something like that:
We use TChart to analyse Data we collected from Build Automation System. Usually, the X(bottom) axis is the time, the Y(Left) axis is the (kW,kWh,m³,l/h, etc...) and the Y(right) axis is the °C or °F for outdoor/indoor temp et... Often, we have other series that are On/Off data. I want to be able to show those data in the same graphic. My idea was to show the first one on the bottom using 10 pixel height and the next one over that one. So those one are pixel related and wont be screwed by the Y axis zoom and scale.

What i did try to do is:
Using a TList to put all my On/Off series in and removing them from the TChart (so they wont be draw automatically)
Then, on the AfterDraw of the TChart, i am painting them manually.
This is "good" but im having some speed issue and when i did that, i forgot my code was all based on the TChart. So im screw because there are too much stuff to change to work with that TList of mine.

Is there an exceptional way to get where i wish to go ? I know that most of the time, you guys did already made stuff that i havent heared of. So please, do as usual, and tell me TChart already manage that and point me where to look at to solve my problem.

Thanks a lot.

GoToXY

Re: Drawing series without Y axis

Posted: Fri Mar 25, 2011 3:30 pm
by 10548769
Hi again

I though you may need more information. So there is a screeny of what i have done so far.
ss-lineseries-onoff.png
ScreenShot about the line series without Y axis
ss-lineseries-onoff.png (410.12 KiB) Viewed 8443 times
I did paint the background to be easier to see the 2 lineSeries.

As i told you before, im using the TChart.Series for a lots of stuff (Live Reports, Saving the graphics into my DB, showing a table of values, etc..)

Re: Drawing series without Y axis

Posted: Sat Mar 26, 2011 1:39 am
by 10548769
Oh well, im sorry to have bother you again. Sometimes, my brain just want to remake the world in its own way! :? Anyway, i just figure out that the only thing i had to do is to create a new kind of series from TSeriesLine and override the DrawValue fonction and then, add my code in it. So simple. I must need vacation lol.

Thanks to you to have make it simple as that to make custom series ect... I just finished it and it works like a charm!

Re: Drawing series without Y axis

Posted: Mon Mar 28, 2011 2:11 pm
by yeray
Hello,

Another possibility you could try is to set:

Code: Select all

TChart1.Scroll.Enable = pmHorizontal
This restricts the whole chart to scroll horizontally. So the upper part won't scroll vertically.
However, you could use a chart for the upper part and another chart, or a subcharttool, for the down part. Something as in the example here:
http://www.teechart.net/support/viewtop ... 815#p45475

Re: Drawing series without Y axis

Posted: Tue Mar 29, 2011 12:50 pm
by 10548769
I need the scrolling option for the other series. Only the On/Off series must be unable to be scrolled by the Y axis. But thanks anyway for the idea.

Re: Drawing series without Y axis

Posted: Fri Apr 01, 2011 10:17 am
by narcis
Hi GoToXY,

In that case 2 charts or a subchart tool would be the way to go, as Yeray suggested. You could then restrict scrolling to horizontal for the chart you need.