How to get newline after the title in echarts line chart? - echarts

I would like to add new line after the title, can anyone help me how to i do that?
Here i'm setting options like,
option ={
title: 'test content regarding the line chart'
}
Due to title is long, it is coming on top of legends
tried like,
option ={
title: 'test content regarding the line chart \n'
}
won't workout...
Thanks,

You did it right. Just use the '\n' to add another line and you can use the eChart editor online to test it.
Pay attention on the subtext position when you change the title inserting or removing the new line at the end of the title.
https://ecomfe.github.io/echarts-examples/public/editor.html
You can use this example:
option = {
title: {
text: ' Inserting a break on title \n and another break here \n',
subtext: 'We also have the subtext'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
legend: {
data: ['Production']
},
grid: {
containLabel: true
},
xAxis: {
type: 'value',
data: ['abc','xyz'],
boundaryGap: [0, 0.01]
},
yAxis: {
type: 'category',
data: ['Month 1','Month 2']
},
series: {
name: 'Production',
type: 'bar',
data: [70,80],
isBiggerOrEqual: true
}};

Related

How add labelline to Bubble Chart in EChart

Because some date are overlap, I want to add labelline in each Bubble, How can I do that? Thks
You can add the label option to your series object:
series: [{
type: 'scatter',
symbolSize: function (data) {
...
},
emphasis: {
...
},
label: {
show: true,
position: 'top'
},
itemStyle: {
...
},
...
}]
all the customizations available for this label are here (position, format, etc):
https://echarts.apache.org/en/option.html#series-scatter.label

How do I have text display within the inside of a stacked bar graph in highcharts

How do I have insert text within the stacked sections of a highcharts stacked bar graph ( https://www.highcharts.com/demo/bar-stacked ).
My graph will really only have two columns, and they'll have the y-axis reversed and displayed as so: https://jsfiddle.net/ogjz9ra0/
Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Stacked bar chart'
},
xAxis: {
categories: ['Bananas']
},
colors: ['#1b98ee', '#1366a6'],
yAxis: {
min: 0,
title: {
text: 'Total fruit consumption'
},
},
legend: {
reversed: true,
},
plotOptions: {
series: {
stacking: 'normal'
}
},
series: [{
name: 'John',
data: [4726.78]
}, {
name: 'Brian',
data: [4250.00],
}]
});
What I'd like is to be able to inject text into each of the columns.
https://drive.google.com/file/d/1CDttfeB9mqI5r9voYalsLtEeH0OSs3Ey/view?usp=sharing
I'm still relatively new to HighCharts, so any help would be appreciated.
Thank you all so much again!
I did some googling, and most of the results talk about having the text render inside the bar for non-stacked bar charts. Note that the placing for the problem I'm trying to solve is in the center.
You can use datalabels documentation like this :
plotOptions: {
series: {
stacking: 'normal',
dataLabels: {
enabled: true,
formatter: function() {
// console.log(this) // uncomment this line to see all params available
return 'custom text here'
}
}
}
},
Fiddle

How to make sanity io array select as multiselect?

I have a lot of tags, and I need to select a lot for each document. It is uncomfortable to click one by one every time. Also I see selected elements. How can I remake it into somefield like a multiselect? It could be even native. Or how to select all tags at once?
I am using array:
{
title: 'Language',
name: 'language',
type: 'array',
options: {
layout: 'grid'
},
of: [{
type: 'reference',
title: 'Lang',
to: {
type: 'settingLanguages'
}
}],
},
Dropdown example (Add field to schema):
{
title: 'Genre',
name: 'genre',
type: 'string',
options: {
list: [
{ title: 'Sci-Fi', value: 'sci-fi' },
{ title: 'Western', value: 'western' },
],
},
},
This is currently not possible out of the box with the default array component, but you should be able to create an input like this by building a custom input for it with the behaviour you want.
More on how to build custom inputs: https://www.sanity.io/docs/extending/custom-input-widgets

convert kendo chart type

I have a kendo's scatterline chart on my HTML page.
I have generated it as following.
objchart = $("#chart").kendoChart({
dataSource: {
data: Chartdata
},
background: mainbackground,
series: [{
type: "scatterLine",
xField: "date"
}],
xAxis: {
title: {
text: "Date"
},
min: min_date,
max: max_date,
name: "Date",
template: "#= kendo.toString(value,'MM/dd/yyyy HH:mm:ss')#",
type: "date",
baseUnit: "seconds",
background: xaxisbackcolor,
},
yAxis: {
title: {
text: "Closing stock prices"
},
min: min_close,
max: max_symbol,
background: yaxisbackcolor,
},
title: {
text: "Close and Volume Date-wise"
},
transitions: false,
zoom: setRange,
dragStart: onDragStart,
drag: onDrag,
dragEnd: onDragEnd
}).data("kendoChart");
Following is my datasource (calling from web api)
[{"date":"9/14/2015 1:20:00 AM","close":6.0,"volume":18.0,"open":58.0,"high":42.0,"low":60.0,"symbol":79.0}]
Now, I need to change the type of the chart from scatter line chart into others like series and bar chart.
when I change it as objchart.options.series[0].type = "column", it does not give any output.
It only leaves the blank chart behind.
What is the correct method to change or cast the chart from any type to any other type?
Thank you

Highcharts Pie Chart.How to set labels in two lines

I'm creating a pie chart in highcharts.
Does anybody know how to set data labels in two lines?
I'm finding this problem when the data labels are too long.
http://jsfiddle.net/larrytron/fSjnD/
$(function () {
$('#container').highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
title: {
text: 'Browser market shares at a specific website, 2010'
},
tooltip: {
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
color: '#000000',
maxStaggerLines:1,
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
},
}
},
series: [{
type: 'pie',
name: 'Browser share',
data: [
['Firefox jandler glander gramenauer gramen', 45.0],
['IE', 26.8],
{
name: 'Chrome',
y: 12.8,
sliced: true,
selected: true
},
['Safari', 8.5],
['Opera', 6.2],
['Others', 0.7]
]
}]
});
});
You can simply set width for dataLabels, see: http://jsfiddle.net/Fusher/fSjnD/1/
style: {
width: '100px'
}
You can simply insert in the data labels:
data: [
['Firefox jandler glander <br><b>gramenauer gramen</b>', 45.0],
Note, for some reason, the second line loses the bold formatting unless you addit back in using tags.
http://jsfiddle.net/ZMLSW/