I don't know if it is possible but I tried to Embedded a Chartview from Highchart android API in order to show a line chart in a DialogFragment. Unfortunately, I didn't succeed anyone knows if it's possible and maybe Help me to do it. Here's my code this is a test code in order to get this dialog fragment.
ChartDialogFragment.java
public class ChartDialogFragment extends DialogFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout to use as dialog or embedded fragment
View view= inflater.inflate(R.layout.dialog, container, false);
HIChartView chartView =view.findViewById(R.id.hc);
HIOptions options = new HIOptions();
HITitle title = new HITitle();
title.setText("Logarithmic axis demo");
options.setTitle(title);
HIXAxis xaxis = new HIXAxis();
xaxis.setTickInterval(1);
options.setXAxis(new ArrayList<>(Collections.singletonList(xaxis)));
HIYAxis yaxis = new HIYAxis();
yaxis.setType("logarithmic");
yaxis.setMinorTickInterval(0.1);
options.setYAxis(new ArrayList<>(Collections.singletonList(yaxis)));
HITooltip tooltip = new HITooltip();
tooltip.setHeaderFormat("<b>{series.name}</b><br />");
tooltip.setPointFormat("x = {point.x}, y = {point.y}");
options.setTooltip(tooltip);
HILine line1 = new HILine();
line1.setPointStart(1);
line1.setData(new ArrayList<>(Arrays.asList(1, 2, 4, 8, 16, 32, 64, 128, 256, 512)));
options.setSeries(new ArrayList<>(Collections.singletonList(line1)));
chartView.setOptions(options);
return view;
}
/** The system calls this only when creating the layout in a dialog. */
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return dialog;
}}