You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 16 Next »

This is example of how we have implemented the android mobile app in BellaDati using BellaDati-android-views library. You can use the native components of this library to visualize charts, kpis and tables. You can download this library here.

 

The data to visualize are from BellaDati reports. See the Report section.

 

First of all you have to use android-sdk to make xAuth. See section Java SDK --> Android.

 

How to use the BellaDati-android-views library

  1. Copy the jar file to your project to libs folder
  2. Right click on jar and select Use As Library
  3. After this you can do xAuth to BellaDati cloud. It is in this section. The xAuth returns BellaDatiService so you can use the BellaDati-android-views library.
  4. Add to your layout.xml component which you want to use. For example I would like to use StackedBarChart, see below.
  5. So I added com.belladati.android.views.StackedBarChart and set it height, width and id.
  6. In code behind java class , I have to implement this component. In onCreateView method implement chart.

    StackedBarChart myChart=(StackedBarChart) rootView.findViewById(R.id.chart);
  7. So you can use methods of StackedBarChart. First of all you have to set BellaDatiService and id chart.  Service returns xAuth so you can use it. Id chart is API id from BellaDati cloud. Here is example of my StackedBarChart id.

    myChart.setService(service);
    myChart.setIdChart(“47892-Opjy5zwHvO”);
  8. Also you can use MultiValueFilter for set filter to your report view. For example:

    Filter.MultiValueFilter fUserId;
    fUserId = FilterOperation.IN.createFilter(getAttribute("L_DRIVER", "32531"));
    fUserId.addValue(new FilterValue("D1654"));
     
    ObjectNode filterNode = new ObjectMapper().createObjectNode();
    filterNode.setAll(fUserId.toJson());
     
    mChart.setFilterNode(filterNode);

    First parameter of getAttribute is name of param in dataset which you want to filter and second is Id of dataset. See below. FilterValue parameter is value what do you want to filter. You can also filter for more parameters like date etc. 


  9. The last step is call method createStackedBarChart().

    try {
        mChart.createStackedBarChart();
    } catch (Exception e) {
        Log.e("error",e.getMessage());
    }
  10. Now you have chart in your mobile app. There are more options to setup your chart maybe: Axes text colour, Legend text colour, ValueTextColor etc.



  • No labels