dots without connection to other dots

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
BubikolRamios
Posts: 9
Joined: Sun Dec 19, 2010 1:51 am
antibot: No, of course not.

dots without connection to other dots

Post by BubikolRamios » Sun Dec 19, 2010 11:00 am

if you look hard(i don't have to, it bothers me without looking hard) you will see displaced dots on blue line, and I already moved dots arround to do better, no success.The point of image beeing that if you just draw line, then there are no red dots in empty space, but they should be there.
Image

1. By default if I draw line, there will be nothing where dots are now hanging in space (and it is correct that they are there)
2. if I do stuff like:

Code: Select all

 renderer.setSeriesShape(1, new Ellipse2D.Double(0.0, -1.0, 2.0, 2.0));
 renderer.setSeriesShapesVisible(0, true);
the missing dots appears,but no matter what I do, can't melt (hide) dots into line, they are allways displaced
3. did line a bit more thick, but dots in line are still visible, but anyway , thicker lines goes off my aesthetic filling.

I guess it should be made, that dots (of width of setSeries line) would appear by default where there are no connectable data, not on line itself ofcourse
As far as I see, it cant be done in acceptable way now. Or can it be ?

barbarius
Posts: 74
Joined: Tue Jul 27, 2010 9:33 am
antibot: No, of course not.

Re: dots without connection to other dots

Post by barbarius » Mon Dec 20, 2010 2:08 am

would you share the code? maybe we can figure out something by working on source, that would be easier, at least for me..

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: dots without connection to other dots

Post by skunk » Mon Dec 20, 2010 2:55 am

In order to be plotted at the correct point, the shape needs to be centered. Try

Code: Select all

new Ellipse2D.Double(-1.0, -1.0, 2.0, 2.0)

BubikolRamios
Posts: 9
Joined: Sun Dec 19, 2010 1:51 am
antibot: No, of course not.

Re: dots without connection to other dots

Post by BubikolRamios » Tue Dec 21, 2010 12:57 am

Here is a live example (does not get melted in, the dots are 'off line', best seen for my eyes on blue line):
http://agrozoo.net/jsp/statistics_agric ... .jsp?l2=en

Code: Select all

        final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
        for (int i = 0; i < 20; i++)
        {
          renderer.setSeriesShape(i, new Ellipse2D.Double(-1.0, -1.0, 2.0, 2.0));
          renderer.setSeriesShapesVisible(i, true);

          renderer.setSeriesStroke(
              i, new BasicStroke(
                  2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
                  1.0f, new float[] {10.0f, 6.0f}, 0.0f
              )
          );
        }

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Re: dots without connection to other dots

Post by skunk » Tue Dec 21, 2010 1:54 am

Try inserting this before your code:

Code: Select all

plot.setRenderer(new LineAndShapeRenderer() {
    public boolean getItemShapeVisible(int series, int item) {
        if (!getSeriesShapesVisible(series).booleanValue())
            return false;
        Number prev = null;
        if (item > 0)
            prev = getPlot().getDataset().getValue(series, item-1);
        Number next = null;
        if (item < getPlot().getDataset().getColumnCount(series)-1)
            next = getPlot().getDataset().getValue(series, item+1);
        return ((prev == null) && (next == null))
    }
});

BubikolRamios
Posts: 9
Joined: Sun Dec 19, 2010 1:51 am
antibot: No, of course not.

Re: dots without connection to other dots

Post by BubikolRamios » Tue Dec 21, 2010 2:52 pm

it says that getColumnCount does not take any parameters.

Code: Select all

getPlot().getDataset().getColumnCount(series)
Doh, moving 'series' out, makes it workable, and looks like it solves the problem.

Up: old, down:new:
Image

Many thanks !

Locked