1

I tried to display some map results in JustPy, but HighMap data labels in JustPy show as rotated, but only the label is roated not the map itself.

import justpy as jp

my_chart_def = """
{
 chart: {
    map: 'custom/europe',
    borderWidth: 1
  },

  title: {
    text: 'Nordic countries'
  },

  subtitle: {
    text: 'Demo of drawing all areas in the map, only highlighting partial data'
  },

  legend: {
    enabled: false
  },

  series: [{
    name: 'Country',
    data: [
      ['is', 1],
      ['no', 1],
      ['se', 1],
      ['dk', 1],
      ['fi', 1]
    ],
    dataLabels: {
            enabled: true,
            color: '#FFFFFF'
        },
    }]
}
"""

def chart_test():
    wp = jp.WebPage()
    wp.head_html = """
    <script src="https://code.highcharts.com/maps/9.2.2/highmaps.js"></script>
    <script src="https://code.highcharts.com/mapdata/custom/europe.js"></script>
    """
    my_chart = jp.HighCharts(a=wp, classes='m-2 p-2 border w-1/2 h-screen', options=my_chart_def)
    my_chart.options.chart.type = 'map'
    my_chart.options.series[0].name = 'Test chart'
    my_chart.options.title.text = 'Data'
    return wp

jp.justpy(chart_test)

This is what I got: Map1

If I rotate the map 90 degrees, this is what I see, and the label seems aligned Rotated

Wolfgang Fahl
  • 15,016
  • 11
  • 93
  • 186
wy1189
  • 11
  • 2
  • I see this is based on https://github.com/WolfgangFahl/pyJustpyWidgets/blob/main/jpdemo/examples/highchartmap_demo.py where the issue is the version of the map. What's the problem with the rotation? – Wolfgang Fahl Aug 21 '22 at 04:46
  • The original map without rotations is not aligned with the data label. Your demo also shows this problem. – wy1189 Aug 21 '22 at 21:24

1 Answers1

1

I've reproduced your example in the editor, and everything seems to be correct https://jsfiddle.net/BlackLabel/6g92m7br/, so the issue occurs from the justpy side.

However, since 9.3.0 Highcharts Maps has improved geometry https://www.highcharts.com/blog/changelog/#highcharts-maps-v9.3.0, which could have affected another framework's behaviour. I would suggest reaching out JustPy developers directly.

As a workaround, you can try to play around with setting x, y dataLabels positions, e.g:

  plotOptions: {
    series: {
      dataLabels: {
        x: 15,
        y: -50
      }
    }
  }

Demo: https://jsfiddle.net/BlackLabel/bnejx2kc/

API Reference: https://api.highcharts.com/highmaps/plotOptions.map.dataLabels.x https://api.highcharts.com/highmaps/plotOptions.map.dataLabels.y

magdalena
  • 2,657
  • 1
  • 7
  • 12
  • Yeah, I think this is about the justpy's problem not related to the highmap. I should've mentioned that I tried this in the pure high chart and I didn't encounter any problems with it. Thank you for your work and for letting me know the manual adjustments for x and y. That might be working for now, but it's definitely better to be solved in the justpy itself. – wy1189 Sep 04 '22 at 13:42