PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.53k stars 9.01k forks source link

How to save a full picture that exceeds the image data and slides the data to the right instead of the current screen image #4346

Open xinyu1993abc opened 5 years ago

xinyu1993abc commented 5 years ago

The own saveToGallery() method saves the image before the current screen display. I want to achieve the effect of saving all the image data sliding backwards beyond the width of the current screen, saving a complete long image. Data picture

jagadishnallappa commented 3 years ago

Hi,

I don't know if this answer will be bashed. But it worked for me. I just figured it out.

<HorizontalScrollView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fillViewport="true"
                android:scrollbars="horizontal">

                <LinearLayout
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:orientation="vertical" >

                    <com.github.mikephil.charting.charts.CombinedChart
                        android:id="@+id/combinedChartBroodingGrowing"
                        android:layout_width="3000dp"
                        android:layout_height="1000dp"
                        />
                </LinearLayout>
            </HorizontalScrollView>

Unfortunately you'll need to specify the layout_width and layout_height explicitly in order for this to work(You'll need to play around and decide what's best for you. Also, please note: I haven't checked for any side effects. Use with discretion. I'm so sorry!). Also make sure setVisibleXRangeMaximum is not set. And then call saveToGallery() as usual. You'll see the entire chart saved to gallery. :)