如何在Plot.ly JS标题中创建新行 [英] How to create new line in Plot.ly JS title

查看:138
本文介绍了如何在Plot.ly JS标题中创建新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用



这是被调用的代码,其中标签是在别处定义的变量:

  var graph_data = [ 
{
值:值,
标签:标签,
类型:'pie'
}
];
var layout = {
title:'我们的支持团队对您的问题或疑虑的响应能力如何?'
};
Plotly.newPlot(chartID,graph_data,layout);

我尝试在字符串中添加换行符,例如 \ r \ n \\\\ n 并且它不起作用。我也试过改变自动换行的CSS属性,但它没有用。在Plot.ly JS中可以轻松地在多行显示标题的任何建议吗?

解决方案

使用< br> 打破情节字符串中的行。


I am using the Plot.ly JS for graphs. The graphs are charting the answers given to certain questions in a survey. So, the title of the graph is the question itself which can get a little long. Right now, the title runs off the graph and is hidden as seen in the image below (can't embed images yet on Stack Overflow so it created a link to the image instead):

This is the code being called where values and labels are variables defined elsewhere:

var graph_data = [
    {
        values: values,
        labels: labels,
        type: 'pie'
    }
];
var layout = {
 title: 'How responsive has our support team been to your questions or concerns?'
};
Plotly.newPlot( chartID, graph_data, layout );

I tried adding new line characters into the string such as \r and \n and \r\n and it did not work. I also tried changing the CSS property of word-wrap and it did not work. Any advice to easily show the title on multiple lines in Plot.ly JS?

解决方案

Use <br> to break lines in plotly strings.

这篇关于如何在Plot.ly JS标题中创建新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆