Casillas
Posts: 3
Joined: Tue Jan 08, 2019 9:47 am

How to show Loading before initializing Highcharts

How to show Loading before initializing Highcharts? BlockCallFunction need any time,before rendering Highcharts,I want to show loading.
rafalS
Posts: 2665
Joined: Thu Jun 14, 2018 11:40 am

Re: How to show Loading before initializing Highcharts

Hi, Casillas!

Are you looking for something like this? https://jsfiddle.net/BlackLabel/7ghk215b/

API: https://api.highcharts.com/highcharts/loading

Best regards!
Rafal Sebestjanski,
Highcharts Team Lead
pradeepkumarreddy
Posts: 16
Joined: Mon Jun 20, 2022 1:58 pm

Re: How to show Loading before initializing Highcharts

How to achieve this in HighCharts Android ?
hubert.k
Posts: 1164
Joined: Mon Apr 11, 2022 11:48 am

Re: How to show Loading before initializing Highcharts

Hi pradeepkumarreddy!
Our Android developer suggests you hide the View of Highcharts. By using this you are minimizing the JavaScript code as a string. You can check the code below.

Code: Select all

HIChartView chartView = findViewById(R.id.chartview1);
TextView loadingView = findViewById(R.id.loading);
HIOptions options = new HIOptions();

final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
    @Override
    public void run() {
        HILine series1 = new HILine();
        Number[] series1_data = new Number[] {1, 2, 3, 2, 4};
        series1.setData(new ArrayList<>(Arrays.asList(series1_data)));
        options.setSeries(new ArrayList<>(Arrays.asList(series1)));

        chartView.setOptions(options);
        chartView.setVisibility(View.VISIBLE);
        loadingView.setVisibility(View.GONE);

    }
}, 1500);
View:

Code: Select all

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.highsoft.highcharts.core.HIChartView
        android:visibility="gone"
        android:gravity="center"
        android:layout_width="match_parent"
        android:id="@+id/chartview1"
        android:layout_height="500dp"/>

    <TextView
        android:id="@+id/loading"
        android:text="Loading..."
        android:textSize="40sp"
        android:gravity="center"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</FrameLayout>
Feel free to ask any further questions.
Best regards!
Hubert Kozik
Highcharts Developer

Return to “Highcharts Stock”