Pre loader

How to use utf8 strings for axis title in android ?

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums


hi everyone
when i use utf8 string such as ‘محور’ = axis in persian sciChart lookLike this .
i tried different fonts but did not work .


    // Obtain the SciChartBuilder instance
    val sciChartBuilder = SciChartBuilder.instance()

    val myCustomFont: Typeface? = ResourcesCompat.getFont(this, R.font.maryam)
    val fontStyle = FontStyle(myCustomFont, 50f, Color.RED)

    val s = String("محور".toByteArray(Charsets.UTF_8))

    xAxis = sciChartBuilder.newNumericAxis().withAxisTitleStyle(fontStyle).withAxisTitle(s).withGrowBy(DoubleRange(0.1, 0.1)).build()
    yAxis = sciChartBuilder.newNumericAxis().withAxisTitle("this is y").withGrowBy(DoubleRange(0.1, 0.1)).build()

    val dataSeries = XyDataSeries(Double::class.javaObjectType, Double::class.javaObjectType)
    dataSeries.append(arrayOf(0.0, 2.0, 4.0, 6.0, 8.0, 10.0), arrayOf(1.0, 5.0, -5.0, -10.0, 10.0, 3.0))

    rs = sciChartBuilder.newColumnSeries()
            .withStrokeStyle(ColorUtil.White, 3f, false)


    UpdateSuspender.using(surface) {
        Collections.addAll<IAxis>(surface.xAxes, xAxis)
        Collections.addAll<IAxis>(surface.yAxes, yAxis)
        Collections.addAll<FastColumnRenderableSeries>(surface.renderableSeries, rs)


and the result :

result image

  • You must to post comments

Hi Darius,

Actually we do support UTF-8 symbols but for now there is no support of RTL text in axis title. That’s why text is rendered incorrectly. I’ve created a task in our bug tracker to fix it.

This should be fixed starting from which you can get from our Maven repository.

Best regards,

  • darius fathi
    thank you
  • darius fathi
    can i use rtl text in annotaions ?
  • Yura Khariton
    Unlike axes we implemented annotations as regular Android Views so TextAnnotation which uses TextView for displaying text should support RTL text out of the box. BTW I’ve updated my answer and axis rendering should be fixed in v2.2.2.2424. Please can you try it and let me know if it works now?
  • darius fathi
    thanks yura . i will try it .
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.