Need axis line to touch chart edge

TeeChart for Java (NetBeans, Eclipse, Android Studio, etc)
Post Reply
keith20mm
Newbie
Newbie
Posts: 6
Joined: Fri Jan 20, 2012 12:00 am

Need axis line to touch chart edge

Post by keith20mm » Mon Jan 23, 2012 11:07 pm

I have a Fastline series on my chart, and I've loaded and plotted xy value pairs on this series.

I also have two other series, one for a 0-origin x-axis and one for a o-origin y-axis.

I only add the 0-origin x-axis series when the fastline y-values pass through or to y=0, and I only add the 0-origin y-axis series when the fastline series x-values pass through or to x=0.

For the 0-origin x-axis, there are only two points, being the x-min and x-max values, with y=0 for both these points, i.e., (xmin,0) and (xmax,0).
For the 0-origin y-axis, there are only two points, being the y-max and y-min values, with x=0 for both these points, i.e., (0,ymax) and (0,ymin).

These two additional series are also Fastline.

The chart is created as:
chart = new TChart(this);
chart.getGraphics3D().getAspect().setView3D(false);
chart.getHeader().setVisible(false);
chart.getLegend().setVisible(false);
chart.getPanel().setBevelOuter(BevelStyle.NONE);
chart.getPanel().setBevelInner(BevelStyle.NONE);

The two axis series, my 0-origin x-axis, and 0-origin y-axis, plot with a margin at each end of their respective lines.

Is there a method/technique to override the chart margins such that my two made up axis series plot border to border, with no margin at each end of their respective lines?

In other words, I'd like the drawing area for these two series to be larger than the drawing rectangle area of the first, XY plot series.

I have tried various settings of PanelMargins and Padding, but these appear to affect the entire outer border of the chart, only.

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Need axis line to touch chart edge

Post by Yeray » Wed Jan 25, 2012 3:16 pm

Hi Keith,

I'd suggest you to try with two ColorLine tools (com.steema.teechart.tools.ColorLine) instead of two extra FastLine series. You can see examples of this tool in the features demo program, under All features\Welcome!\Tools\Color Line
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

keith20mm
Newbie
Newbie
Posts: 6
Joined: Fri Jan 20, 2012 12:00 am

Re: Need axis line to touch chart edge

Post by keith20mm » Wed Jan 25, 2012 8:14 pm

Thank you Yeray, ColorLine is much easier to use than ChartPaintListener().chartPainted(ChartDrawEvent e), where I had to determine whether the axis line needed to drawn or not.

As to using a series to create an axis... well, that is futile effort to have any value outside the margin.

I had resorted to canvas drawing, which does work just fine.... however, the ColorLine is much simpler.

My grief was that I could not find an example of what you describe, as this is Android Java. The ColorLine tool appears in no Android Java examples, that I could find. As I had obtained the source code with my SDK, I was able to find the ColorLine tool .java file, and reason out how it was to be used, only after you had pointed out the existence of such a tool.

All features\Welcome!\Tools\Color Line doesn't appear in any of the provided data (SDK+source), neither was I able to locate online any html representation or description of all features, organized as such. I do find ColorLine in the Javadoc, now that you've pointed it out as suitable for a line drawn as axis. (Android Java tools stop at Tutorial11, and there is no Tools tutorial.)

I did notice, however, that a number of requests for solid documentation, over the years, has been requested, that just hasn't happened.

These requests data back to VCL, 2004 days. I'd think that eight years would be sufficient time to compile a good user-side document, for all platforms, including Android Java. The Javadoc files are very good for showing structure of the classes, along with inheritance, but in no way shows 'how to use'... i.e., the Javadoc section for ColorTool has no simple example for the class ColorLine.

Example:

Q: I need a 0-origin x-y axis

A: Use two ColorLine tools as an x-y axis:

import com.steema.teechart.tools.ColorLine;

// setup an x-axis
ColorLine mclh=new ColorLine(chart.getChart()); // create a new colorline and associate it with the chart
mclh.setAxis(chart.getAxes().getLeft()); // associate ColorLine to the chart's Left axis
mclh.setAllowDrag(false); // disable dragging of the x-axis line
// setup an y-axis
ColorLine mclv=new ColorLine(chart.getChart()); // create a new colorline and associate it with the chart
mclv.setAxis(chart.getAxes().getBottom()); // associate ColorLine to the chart's Bottom axis
mclv.setAllowDrag(false); // disable dragging of the y-axis line


The alternative to clear examples is to sit there asking Eclipse (or other RAD IDE) to show methods or properties and hopefully try and select or peck in something that happens to operate as desired. The other alternative is to work through the entire inheritance to try to determine what method/property applies to which objects. The third alternative is to find someone else who has implemented a similar concept. The fourth alternative is to have a LIST OF EXAMPLES describing the applied effect and how to implement the effect. There may be other alternatives to making something work, but this last alternative is pretty much sorely lacking in the software provision effort.

I can personally share my frustration with you that what should be simple tasks turn out to take hours to 'try' or 'locate an example'... of course, once you've covered the path, such is retained for future use. I keep a file "TChart How To by keith20mm" that I always update for new techniques found, stumbled upon, or in other's example. The fact is that such a file should have been provided with the software, regardless of platform.

Back in TChart Pro VCL 5, there was a very good executable that allowed for varying field values, and thence obtaining the actual (Delphi) source code in a lower pane. Such would be an exceptionally nice feature to add to the little TeeChart-release.apk provided with the binary and source Android Java release, along with the not shown ColorLine tool.

Thankfully, the TChartPro VCL source was also obtained years ago, as comparison material to the Java form.

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Need axis line to touch chart edge

Post by Yeray » Thu Jan 26, 2012 10:23 am

Hi Keith,

We could discuss if the documentation provided in the different versions is really so bad or not. I agree it could look old fashioned but I still think its purpose is being functional. The VCL and .NET helps are integrated with the IDEs so I think they're just fine.

Regarding TeeChart Java for Android, note it's a new version and there are some aspects to improve. For example, all the versions come with the tutorials to give an overview of the component, the help files to navigate through the classes and the demos to explore the component possibilities. And here it is one lack in TeeChart Java for Android. This version shares most part of the code with TeeChart Java version so the majority of features in TeeChart Java are also possible with TeeChart Java for Android. Then, I think TeeChart Java for Android should be shipped with the SWT examples, and the demo for Android could just show a very little set of features and the differences with the desktop version. And it would keep little enough to fit in the Android market.

In the meanwhile you could download the evaluation version (or the beta version) to get the SWT/Swing feature demo examples.

Regarding the date, there have been many changes in the help all this time. However, as we always try to keep backwards compatibility, many items in the help haven't changed. But all the new properties and methods should be documented with at least a little definition or explanation in the help.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply