JFreeChart domain / range ranges defined

Can someone give a simple explanation of JFreeChart axis types?

  • First, we have axes based on the class hierarchy (ValueAxis, CategoryAxis, many subclasses)

  • We also have a "domain axis" compared to a "range limit" (only for xy graphs?). It is not clear how they relate to axes based on a class hierarchy. These are not classes, but there are setDomainAxis and setRangeAxis methods in XYPlot.

  • Visually, I would think that in the horizontal and vertical axes I'm not sure how they relate to previous concepts (is "always" a domain?). I think the x-axis is horizontal and the y-axis is vertical, but I'm not sure if this always happens with XYPlot.

EDIT: I tried to learn both the API docs and the developer's guide. API documents simply provide a hierarchy of classes, but it is not clear when and how to use them. The developer’s guide also does not provide a definition or explanation of the “domain axis” and “range axis”, it simply uses these terms. I admit that the question is broad because I could not find this basic information anywhere. I would like to have a common understanding, but for now my most important question is what determines what should be on the horizontal / vertical axis (the "domain" is always horizontal, if not how to set it?), Because I get some crazy results and I don’t know where to start debugging. It is also unclear whether CombinedRangeXYPlot or CombinedDomainXYPlot should be used if I want two charts to be placed one above the other.

EDIT2: Although this was not answered, I found that in the meantime it is determined whether the domain axis is horizontal: PlotOrientation . This setting (at the combined graph level) also determines whether CombinedRangeXYPlot / CombinedDomainXYPlot will position the two graphs horizontally or vertically.

+6
source share
1 answer

In XYPlot each series you display is a discrete function f[t] with a discrete set of t {t1, t2, ..., tn} and their corresponding values ​​{f [t1], f [t2], ..., f [ tn]}.

  • the domain of the function contains all possible values ​​of t .
  • the range of the function contains all possible values ​​of the function f[t] .

The important thing is that there can be several points in the function with the same value in the range axis, but each function point must have a unique value on the domain axis. For example: Bananas can have the same prize as Apples, but there can be two prizes for a banana (tell brokers about it!).

Usually the horizontal axis is the domain axis, but it can also be changed.

Then you have the Axis class, which contains many possible types of visual representations of the axes (logarithmic / linear / category / without labels / grid lines / blue axis line ...).

So, in general: Domain and range are mathematical definitions and represent some restrictions on the displayed data. Terms are used for a special kind of data (a classic form of function that everyone teaches in a primary school). They have nothing to do with their visual presentation. Thus, the range as well as the domain axis of the graph can be defined as CategoryAxis , a NumberAxis , a LogarithmicAxis or something else.

EDIT (for completeness): you can change the orientation of the graph (i.e. determine which axis is the axis of the range) using PlotOrientation.VERTICAL / PlotOrientation.HORIZONTAL .

+7
source

Source: https://habr.com/ru/post/922584/


All Articles