syampillai / SOCharts

A wrapper around the "echarts" JavaScript library to use it as a Vaadin component.
Apache License 2.0
27 stars 11 forks source link

Cannot add lines to a chart #26

Closed MyHouseIsBig closed 6 months ago

MyHouseIsBig commented 1 year ago

I've tried almost everything to solve it by myself but i cannot find a way to create a line with a start position and an end position and add it to a chart. From your documentation that I found on here I coded the following. The xValues and yValues are some random values that I generated for a LineChart but I also tried with some custom numeric values.

Any help would be really appreciated ❤️.

        // Add a custom line on the chart
        Line line = new Line(new Shape.Point(xValues.get(99900), yValues.get(99900)), new Shape.Point(xValues.get(99990), yValues.get(99990)));
        line.setName("Linea importantissima");
        line.getStyle(true).setFillColor(new Color("red"));
        line.getStyle(true).setLineWidth(10);

        soChart.add(... , line);
syampillai commented 6 months ago

This code is perfectly fine. I think the line is lying outside the canvas. Please check the values of the coordinates. To verify that it is working, you could try: Line line = new Line(new Shape.Point(100, 100), new Shape.Point(600, 600));

syampillai commented 6 months ago

I'm closing this as this is not an issue.

syampillai commented 6 months ago

Closed