We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If i update line chart and invoke 'withMax' with parameter smaller than 1, then YAxis max value is 19.0. There is some example:
public class LineChartExample extends Div { private Checkbox checkbox = new Checkbox("Autoupdate chart"); public LineChartExample() { ApexCharts lineChart = ApexChartsBuilder.get() .withChart(ChartBuilder.get() .withType(Type.line) .withZoom(ZoomBuilder.get() .withEnabled(true) .build()) .build()) .withStroke(StrokeBuilder.get() .withCurve(Curve.straight) .build()) .withTitle(TitleSubtitleBuilder.get() .withText("Product Trends by Month") .withAlign(Align.left) .build()) .withGrid(GridBuilder.get() .withRow(RowBuilder.get() .withColors("#f3f3f3", "transparent") .withOpacity(0.5).build() ).build()) .withXaxis(XAxisBuilder.get() .withType(XAxisType.datetime) .build()) // #001. Can i remove this method and use it from update thread? (see #002) .withYaxis(YAxisBuilder.get() .withOpposite(true) .withTickAmount(0.1) .withDecimalsInFloat(3.0) .build() ) .withSeries( new Series<>("SAMPLE A", new double[]{0, 0}) ) .build(); add(lineChart); add(checkbox); setWidth("70%"); checkbox.setValue(true); long schedulerStartedTs = System.currentTimeMillis(); ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); executorService.scheduleAtFixedRate(() -> { try { double maxValue = Double.MIN_VALUE; double minValue = Double.MAX_VALUE; if (checkbox.getValue()){ //long periodDay = 24 * 60 * 60 * 1000; //long periodHour = 60 * 60 * 1000; //long periodMinute = 60 * 1000; long periodSec = 1000; long periodType = periodSec; int periodsAge = 1000; List<double[]> list = new LinkedList<>(); for (int periodCounter = -periodsAge; periodCounter <= 0; periodCounter++) { long ts = System.currentTimeMillis() + periodType * periodCounter; double radians = Math.PI * ts / 180000; double sin = Math.sin(radians * 2); // After 10 seconds a little increase min and max values if ((System.currentTimeMillis() - schedulerStartedTs) > 10000) sin = sin * 1.001; if (sin > maxValue) maxValue = sin; if (sin < minValue) minValue = sin; list.add(new double[]{ts, sin}); } Series<Object> series = new Series<>("SAMPLE A", list.toArray()); Optional<UI> ui1 = getUI(); double finalMaxValue = maxValue; double finalMinValue = minValue; getUI().ifPresent(ui -> { ui.access(() -> { // #002 lineChart.setYaxis(YAxisBuilder.get() // Commented out next 3 lines and moved it to builder (see #001). Why it does't work there? //.withOpposite(true) //.withTickAmount(0.1) //.withDecimalsInFloat(5.0) .withMax(finalMaxValue) .withMin(finalMinValue) .build()); lineChart.updateSeries(series); Notification.show("Updated... Min=" + finalMinValue + ". Max=" + finalMaxValue, 10000, Notification.Position.BOTTOM_END); }); }); } int q = 0; } catch (Throwable e) { e.printStackTrace(); } }, 1, 1, TimeUnit.SECONDS); addDetachListener(event -> { executorService.shutdown(); }); } }
Add LineChartExample object to your UI and start app. At start double sin values are smaller than 1.0 and YAxis look as this:
LineChartExample
double sin
After 10 seconds sin amplitude values will some increase and chart looks another:
sin
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered:
Using this dependency:
<dependency> <groupId>com.github.appreciated</groupId> <artifactId>apexcharts</artifactId> <version>2.0.0.beta10</version> </dependency>
Sorry, something went wrong.
No branches or pull requests
If i update line chart and invoke 'withMax' with parameter smaller than 1, then YAxis max value is 19.0. There is some example:
Add
LineChartExample
object to your UI and start app. At startdouble sin
values are smaller than 1.0 and YAxis look as this:After 10 seconds
sin
amplitude values will some increase and chart looks another:Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: