You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hello!
I'm having a little difficulty, I hope I can get your help.
development environment:
jdk17
The pom information is the pom of the main branch
This problem seems to have appeared in #129. I don’t know if it has been fixed?
My expectation is to use 30 units as a major scale, which seems to automatically change to 25 units.
package io.fair_acc.sample;
import io.fair_acc.chartfx.XYChart;
import io.fair_acc.chartfx.axes.spi.DefaultNumericAxis;
import io.fair_acc.chartfx.plugins.Zoomer;
import io.fair_acc.dataset.spi.DoubleDataSet;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class SimpleChartSample extends Application {
private static final int N_SAMPLES = 360;
@Override
public void start(final Stage primaryStage) {
final StackPane root = new StackPane();
final DefaultNumericAxis xAxis = new DefaultNumericAxis("index");
xAxis.setAutoRanging(false);
xAxis.setAutoGrowRanging(false);
xAxis.invertAxis(false);
xAxis.set(0,360);
xAxis.setTickUnit(30);
final DefaultNumericAxis yAxis = new DefaultNumericAxis("Values");
yAxis.setAutoRanging(true);
final XYChart chart = new XYChart(xAxis, yAxis);
root.getChildren().add(chart);
final DoubleDataSet dataSet1 = new DoubleDataSet("data set #1");
chart.getPlugins().add(new Zoomer());
final double[] xValues = new double[N_SAMPLES];
final double[] yValues1 = new double[N_SAMPLES];
for (int n = 0; n < N_SAMPLES; n++) {
xValues[n] = n;
yValues1[n] = Math.sin(Math.toRadians(n));
}
dataSet1.set(xValues, yValues1);
chart.getDatasets().addAll(dataSet1);
final Scene scene = new Scene(root, 800, 600);
primaryStage.setScene(scene);
primaryStage.show();
xAxis.tickUnitProperty().addListener((observableValue, number, t1) -> {
System.out.println("tickUnitProperty:"+number+"----"+t1);
});
Platform.runLater(() -> {
try {
System.out.println("tickUnit:"+xAxis.getTickUnit());
Thread.sleep(100);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
xAxis.setTickUnit(30);
});
}
public static void main(final String[] args) {
Application.launch(args);
}
}
The text was updated successfully, but these errors were encountered:
Sorry, that's an oversight as Axis::setTickUnit is not really part of the public API. The value gets overwriten by the tick computation of the axis itself. You can set it by extending an Axis and overwriting AbstractAxis::computePreferredTickUnit.
This will be addressed in the future and is captured in the TODO list in #622.
hello!
I'm having a little difficulty, I hope I can get your help.
development environment:
jdk17
The pom information is the pom of the main branch
This problem seems to have appeared in #129. I don’t know if it has been fixed?
My expectation is to use 30 units as a major scale, which seems to automatically change to 25 units.
The text was updated successfully, but these errors were encountered: