Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LineChart hide Axis #101

Closed
samuellim18 opened this issue Jun 15, 2020 · 7 comments
Closed

LineChart hide Axis #101

samuellim18 opened this issue Jun 15, 2020 · 7 comments

Comments

@samuellim18
Copy link

Hi, I would like to know if it is currently possible to hide the x/y axis of the chart. I am using a timestamp format with milliseconds and this takes up a lot of tile space and cannot seem to find a method to hide it. I know the standard line chart uses the following:

xAxis.setTickLabelsVisible(false);
yAxis.setTickLabelsVisible(false);
@HanSolo
Copy link
Owner

HanSolo commented Jun 15, 2020

Hi there, it would be good if you could provide a bit more information. What chart/skin are you talking about? The best would be to provide a short code snippet that shows the problem so that I can reproduce it on my machine. Thank's, Gerrit

@samuellim18
Copy link
Author

samuellim18 commented Jun 15, 2020

image
image

Hi, its the smoothed line chart where the timestamp takes up too much space and I was wondering if it is possible to hide it so the chart itself becomes bigger

@samuellim18
Copy link
Author

samuellim18 commented Jun 15, 2020

In terms of code (Let me know if I missed out anything and sorry for the trouble):

    private ScheduledExecutorService scheduledExecutorService;
    private int timeI = 1;
    XYChart.Series<String,Number> series1= new XYChart.Series<>();
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yy-MM-dd HH:mm:ss.SSS");
       scheduledExecutorService = Executors.newSingleThreadScheduledExecutor();
        ArrayList<String[]> dataArrayList = new ArrayList<>();
        // put dummy data onto graph per second
        scheduledExecutorService.scheduleAtFixedRate(() -> {

            // get a random integer between 0-10
            Integer random = ThreadLocalRandom.current().nextInt(10);
            // Update the chart
            Platform.runLater(() -> {

                // get current time
                Date now = new Date();
                // put random number with current time
                XYChart.Data datas1 = new XYChart.Data<>(simpleDateFormat.format(now), random);


                String[] dataArray = {(String) datas1.getXValue(), String.valueOf(datas1.getYValue())};
                dataArrayList.add(dataArray);

                series1.getData().add(datas1);
                if (series1.getData().size() > WINDOW_SIZE){
                    series1.getData().remove(0); }
                if (series2.getData().size() > WINDOW_SIZE)
                    series2.getData().remove(0);
            });
        }, 0, 10, TimeUnit.MILLISECONDS);

@HanSolo
Copy link
Owner

HanSolo commented Jun 15, 2020

Ah, ok will take a look at it, thx 👍🏻

@HanSolo
Copy link
Owner

HanSolo commented Jun 16, 2020

I took a look at it and indeed there was no easy way to hide them. So I've added methods to show/hide the ticklabels for x and y. In the latest commit (b3da3e3) you can either call the setter like

tile.setTickLabelsXVisible(false);

or use it in the TileBuilder as follows:

...
.tickLabelsXVisible(false)

@HanSolo HanSolo closed this as completed Jun 16, 2020
@samuellim18
Copy link
Author

That is much appreciated. Thank you!

@HanSolo
Copy link
Owner

HanSolo commented Jun 16, 2020

Just let me know if you stumble upon other things that are missing...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants