1

I am using highcharts in C# .net application with javascript.

The code that overrides the behavior of highchart call (for test):

var originalHighcharts = $.fn.highcharts;

$.fn.highcharts = function (options) {
    var additionalSettings = {
        series: [{
            name: `${'עברית'}`, // Hebrew series name
            dataLabels: {
                enabled: true,
                useHTML: true,
                style: {
                    direction: 'rtl',
                    unicodeBidi: 'bidi-override',
                    textAlign: 'right'
                }
            }
        }],
        plotOptions: {
            series: {
                shadow: false
            }
        },
        exporting: {
            fallbackToExportServer: false,
            pdfFont: {
                normal: '/Content/fonts/DavidLibre-Regular.ttf',
                bold: '/Content/fonts/DavidLibre-Bold.ttf',
                italic: '/Content/fonts/davidLibre-medium.ttf'
            },
            chartOptions: {
                chart: {
                    style: {
                        fontFamily: 'DavidLibre, Tahoma, sans-serif'
                    }
                },
                lang: {
                    decimalPoint: ',',
                    thousandsSep: '.',
                    rtl: true
                }
            }
        },
        lang: {
            decimalPoint: ',',
            thousandsSep: '.',
            rtl: true
        },
        chart: {
            styledMode: false,
            style: {
                fontFamily: 'DavidLibre, Tahoma, sans-serif',
                direction: 'rtl'
            }
        },
        title: {
            useHTML: true
        }
    };

    options.series = {};
    var newOptions = $.extend(true, {}, options, additionalSettings);

    // Call the original highcharts function with the merged options
    return originalHighcharts.call(this, newOptions);
};

The DavidLibre is for Hebrew font (ttf files).

The pdf is export fine, except that the word עברית is shown swapped when pdf is exported (תירבע) in the pdf file. When the word is a word in English, it is shown OK.

For png files - the export is also fine.

Why pdf show the Hebrew word in reverse order and how to fix that? (without reversing the string itself, since there are also words in English).

Also, I though for adding the character \u200E before and after the Hebrew string - that do the thing, but it is shown, and maybe another Hebrew font supports this, but what exactly.

3
  • For the reverse. Try mark the word character by character at the orde, just befor the hebrew to the end, you see ״ע״ first, and ״ב״ second, and so on at the order of עברית (as should be). Only pdf has that problem. I cannot reverse that word. Sometimes there are English letters, and I need considering them either. Commented Mar 10 at 19:53
  • Also what can be done in order use proper displaying an not reverse Commented Mar 10 at 20:20
  • I keep using highchart, since this is used for years in my company. They changed lately (about 3 months) that the pdf is now forbidden from their site. I don't know whether Hebrew was wrong before neigther, but as I need to do the exporting locally, things got complicated. It is locally now exporting ok, and the Hebrew characters are shown. No reverse, whether I use the character '\u200E'. Seems that rtl and direction as I mentioned are irrelevant for the pdf. Now the only thing that is now wrong is that this character is visible. Not fine, since need to be invisible either not reversing. Commented Mar 11 at 4:41

1 Answer 1

1

Setting this option should help: https://api.highcharts.com/highcharts/exporting.allowHTML

Let me know how it goes with this option enabled.

Regards,

Sign up to request clarification or add additional context in comments.

2 Comments

It didn't work either. Just after useHTML: true
If the issue persists, you can always raise a bug ticket here: github.com/highcharts/highcharts.net/issues

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.