javascript - HighChart - Can draw line between Title and SubTitle - Stack Overflow

In HighChart, how can I make a green line appear between my title and my subtitle?JSFiddletitle: {use

In HighChart, how can I make a green line appear between my title and my subtitle?

JSFiddle

title: {
    useHTML: true,
    text: 'Header Text in Line1 </br> Line&nbsp;2 Text',
    style: {
        "text-align": "center"
    }
},    

subtitle: {
    // useHTML: true,
    text: 'SubTitle',
    style: {
        "color": "red",
    }
}

In HighChart, how can I make a green line appear between my title and my subtitle?

JSFiddle

title: {
    useHTML: true,
    text: 'Header Text in Line1 </br> Line&nbsp;2 Text',
    style: {
        "text-align": "center"
    }
},    

subtitle: {
    // useHTML: true,
    text: 'SubTitle',
    style: {
        "color": "red",
    }
}

Share Improve this question edited Aug 30, 2019 at 9:41 41 72 6c 1,7806 gold badges22 silver badges36 bronze badges asked Aug 30, 2018 at 22:51 DhanaDhana 1,6584 gold badges24 silver badges40 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

What you'd need to do is modify the style attribute like this:

title: {
        useHTML: true,
        text: 'Header Text in Line1 </br> Line&nbsp;2 Text',
        style: {
            "text-align": "center",
            "border-bottom": "1px solid green"
        }
    },     

Output

You can make the title display:block and then set the left to 0px. Then set the width to 100%. Now the title spans the whole width of the chart. Now apply a bottom border of green color. You will get the desired effect.

In the style property of the title, you could give

        "width": '100%',
        "display": 'block',
        "left": 0

Have a look at this fiddle - https://jsfiddle/rwmntze8/

Hope this helps!

PS: Someone removed the original image containing the requirements, attached by the OP in the question, during the edits (You can find it in the edit revisions). I have attached it here for reference, in case someone thinks why the green line spans till the end.

Just need to add an empty css below, nothing more:

.highcharts-title {
  border-bottom: 1px solid black;
}

Doing it by pure CSS (not by setting element style using JS) gives you the best performance.

Live example: http://jsfiddle/fqes890o/

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745646204a4637986.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信