Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping RTL text in X-Axis does not work correctly #1768

Open
niradar opened this issue Jul 16, 2016 · 0 comments
Open

Wrapping RTL text in X-Axis does not work correctly #1768

niradar opened this issue Jul 16, 2016 · 0 comments

Comments

@niradar
Copy link

niradar commented Jul 16, 2016

(P.S. Sorry for my English)

When a RTL label is splited on X-Axis, the calculation of its placement are wrong:

current status:
bad

needs to be:
good

When looking on the SVG code that C3 generate, I found that chaning:

<text y="9" x="0" transform="" style="text-anchor: middle; display: block;">
<tspan x="0" dy=".71em" dx="0">תנועת חיפוש</tspan>
<tspan x="0" dy="12" dx="0">אורגאנית</tspan>
</text>

to the following code solves the problem (I changed y instead of dy and put it in seperate text element):

<text y="9" x="0" transform="" style="text-anchor: middle; display: block;"><tspan x="0" dy=".71em" dx="0">תנועת חיפוש</tspan></text>
<text y="21" x="0" transform="" style="text-anchor: middle; display: block;"><tspan x="0" dy="0" dx="0">אורגאנית</tspan></text>

Relevant method in c3: function axis(g)

sample c3 chart with the problem (make the window small to see the word wrap:

var chart = c3.generate({
    data: {
        columns:[
    ["x","\u05ea\u05e0\u05d5\u05e2\u05ea \u05d7\u05d9\u05e4\u05d5\u05e9 \u05de\u05de\u05d5\u05de\u05e0\u05ea","\u05ea\u05e0\u05d5\u05e2\u05d4 \u05d9\u05e9\u05d9\u05e8\u05d4","\u05ea\u05e0\u05d5\u05e2\u05ea \u05d7\u05d9\u05e4\u05d5\u05e9 \u05d0\u05d5\u05e8\u05d2\u05d0\u05e0\u05d9\u05ea","\u05ea\u05e0\u05d5\u05e2\u05ea \u05d4\u05e4\u05e0\u05d9\u05d4"],
["cpc",39150,null,null,null],["(none)",null,6300,null,null],["organic",null,null,12000,null],["referral",null,null,null,3000]],
names:{organic:"\u05ea\u05e0\u05d5\u05e2\u05ea \u05d7\u05d9\u05e4\u05d5\u05e9 \u05d0\u05d5\u05e8\u05d2\u05d0\u05e0\u05d9\u05ea","(none)":"\u05ea\u05e0\u05d5\u05e2\u05d4 \u05d9\u05e9\u05d9\u05e8\u05d4",referral:"\u05ea\u05e0\u05d5\u05e2\u05ea \u05d4\u05e4\u05e0\u05d9\u05d4",cpc:"\u05ea\u05e0\u05d5\u05e2\u05ea \u05d7\u05d9\u05e4\u05d5\u05e9 \u05de\u05de\u05d5\u05de\u05e0\u05ea"},
        type: 'bar',
        groups:[["organic","(none)","referral","cpc"]],

    },
    axis:
    {x: {show:true,type:'category', 
    categories:["\u05ea\u05e0\u05d5\u05e2\u05ea \u05d7\u05d9\u05e4\u05d5\u05e9 \u05de\u05de\u05d5\u05de\u05e0\u05ea",
        "\u05ea\u05e0\u05d5\u05e2\u05d4 \u05d9\u05e9\u05d9\u05e8\u05d4",
        "\u05ea\u05e0\u05d5\u05e2\u05ea \u05d7\u05d9\u05e4\u05d5\u05e9 \u05d0\u05d5\u05e8\u05d2\u05d0\u05e0\u05d9\u05ea",
        "\u05ea\u05e0\u05d5\u05e2\u05ea \u05d4\u05e4\u05e0\u05d9\u05d4"]}},

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant