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

Grid not fitting the points (squeezed) #306

Open
kkuez opened this issue Aug 21, 2021 · 0 comments
Open

Grid not fitting the points (squeezed) #306

kkuez opened this issue Aug 21, 2021 · 0 comments

Comments

@kkuez
Copy link

kkuez commented Aug 21, 2021

The Grid Im using does not fit the datapoints, meaning it does not start by x=0 and x=EndOfX but is squeezed.
https://ibb.co/zXdQJy6

final AxisGrid grid = new AxisGrid();
                    grid.setStrokeWidth(1);
                    grid.setGridType(GridType.VERTICAL);
                    grid.setGridEffect(GridEffect.DOTTED);
                    linearChartView.setGrid(grid);

Edit:
Graphs are not matching, too:
https://ibb.co/72S0kCJ

ConstraintLayout.LayoutParams layoutParamsConstraint =
                    new ConstraintLayout.LayoutParams(50 * lists.get(0).size(),
                            countChecksChartView.getHeight());
        
            countReportsChartView.setLayoutParams(layoutParamsConstraint);
            countReportsChartView.setScale(new Scale(0, highestValueY));
            countReportsChartView.show(lists.get(0));

            final Function1<Float, String> floatToIntStringFun =
                    val -> val.toString().substring(0, val.toString().indexOf("."));
            countReportsChartView.setLabelsFormatter(floatToIntStringFun);

<HorizontalScrollView
                    android:layout_width="wrap_content"
                    android:layout_gravity="left"
                    android:id="@+id/chartHorizontalScrollView"
                    android:layout_height="300dp">

                <androidx.constraintlayout.widget.ConstraintLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:id="@+id/chartConstraintLayout"
                >

                    <com.db.williamchart.view.LineChartView
                            android:layout_width="match_parent"
                            app:chart_lineColor="#458B74"
                            app:chart_lineThickness="2dp"
                            app:chart_smoothLine="false"
                            app:chart_labelsSize="18sp"
                            android:layout_height="match_parent"
                            android:id="@+id/countReportsChartView"
                            app:layout_constraintLeft_toLeftOf="@id/chartConstraintLayout"
                            app:layout_constraintBottom_toBottomOf="parent"/>
                    <com.db.williamchart.view.LineChartView
                            android:layout_width="match_parent"
                            app:chart_lineColor="#8b2323"
                            app:chart_lineThickness="2dp"
                            app:chart_smoothLine="false"
                            app:chart_labelsSize="18sp"
                            android:layout_height="match_parent"
                            android:id="@+id/countChecksChartView"
                            app:layout_constraintLeft_toLeftOf="@id/chartConstraintLayout"
                            app:layout_constraintBottom_toBottomOf="parent"/>
                </androidx.constraintlayout.widget.ConstraintLayout>
            </HorizontalScrollView>
        </LinearLayout>
    </ScrollView>
@kkuez kkuez changed the title Grid not fitting the points Grid not fitting the points (squeezed) Aug 21, 2021
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

1 participant