With androidplot in android studio (kotlin), the x-axis (domain) doesn't work properly. It doesn't scale itself by integer X values. What am I missing here? Scale error on X axis:
val aa1= arrayOf<Number>(20,20,40,40)
val adom= arrayOf<Number>(60,120,120,580)
val series1 : XYSeries = SimpleXYSeries(Arrays.asList(* aa1),SimpleXYSeries.ArrayFormat.Y_VALS_ONLY
,"aa1");
val series1Format = LineAndPointFormatter(Color.BLUE,null,null,null)
plot.addSeries(series1,series1Format)
plot.graph.getLineLabelStyle(XYGraphWidget.Edge.BOTTOM).format = object : Format() {
override fun format(obj: Any, toAppendTo: StringBuffer, pos: FieldPosition): StringBuffer {
val i = Math.round((obj as Number).toFloat())
return toAppendTo.append(adom[i])
}
override fun parseObject(source: String, pos: ParsePosition): Any? {
return null
}
}