How to remove the top line with highcharts on flutter - flutter

how to remove this xasix top line
i want to be like this :
i read a lot of highcharts documents ,but i can't found the answer,I wonder if you have any solutions
my highchars code is:
{
xAxis: {
lineWidth :0,//去掉x轴线
categories: $xAxisData,
tickmarkPlacement: 'on',
gridLineWidth: 1,
gridLineColor: '#808080',
title: {
enabled: false
},
labels: {
style: {
color: '#ffffff'
}
}
},
legend: {
enabled: false
},
yAxis: {
lineWidth: 1,
lineColor: '#808080',
tickmarkPlacement: 'on',
gridLineColor: '#808080',
title: {
text: null
},
labels: {
format: '{value}',
style: {
color: '#ffffff',
fontSize: 12
}
}
},
credits: {
enabled:false
},
tooltip: {
split: false,
valueSuffix: '条'
},
}
Can anyone help me? Thanks a lot!
remove the x axais top line

You can use styled mode to hide grid line on yaxis, article of how to style by css. Catch the last element using CSS pseudo-class :last-of-type and choose how to hide visibility stroke: transparent; or stroke: transparent;.
.highcharts-yaxis-grid path:last-of-type {
/* stroke: transparent; */
stroke-width: 0px;
}
Demo: https://jsfiddle.net/BlackLabel/xdrj846h/

Related

Chartjs - Doughnut chart with multi layer and running value

I have doughnut chart using chartsjs, and also I used multi layer with cutoutPercentage.
The First Layer (Black color) is the Total and the second layer (Red Color) complete is the running value.
type: 'doughnut',
data: {
datasets: [
{
data: Total,
fill: true,
backgroundColor:'rbg(242, 133, 0)',
borderWidth: 3,
weight:1,
},{
data: complete,
fill: true,
backgroundColor:'rgb(255,36,0)',
borderWidth: 3,
weight:1,
}
]
},
options: {
responsive: true,
rotation: 1 * Math.PI,
circumference: 1 * Math.PI,
legend: {
display: false
},
tooltip: {
enabled: false
},
cutoutPercentage: 70,
},
This is what I need,2nd layer is running until reach the total.
In case you need a generic solution, you can use the Plugin Core API and define a beforeInit hook that modifies the chart configuration to fit your needs.
Please take a look at below runnable code and see how it could be done.
new Chart('runningValue', {
type: 'doughnut',
plugins: [{
beforeInit: chart => {
chart.data.datasets = [{
data: [chart.data.total],
backgroundColor: chart.data.totalColor,
borderWidth: 3
},
{
data: [chart.data.complete, chart.data.total - chart.data.complete],
backgroundColor: [chart.data.completeColor, '#fff'],
borderWidth: 3
}
]
}
}],
data: {
total: 50,
complete: 35,
totalColor: 'rbg(242, 133, 0)',
completeColor: 'rgb(255,36,0)'
},
options: {
rotation: -90,
circumference: 180,
plugins: {
legend: {
display: false
},
tooltip: {
enabled: false
}
},
cutout: '70%'
}
});
canvas {
max-height: 100px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.js"></script>
<canvas id="runningValue"></canvas>
Simply define two values and two background colors on the second dataset as shown in the runnable code below.
const total = 50;
const complete = 35;
new Chart('runningValue', {
type: 'doughnut',
data: {
datasets: [{
data: [total],
backgroundColor: 'rbg(242, 133, 0)',
borderWidth: 3
},
{
data: [complete, total - complete],
backgroundColor: ['rgb(255,36,0)', '#fff'],
borderWidth: 3
}
]
},
options: {
rotation: -90,
circumference: 180,
plugins: {
legend: {
display: false
},
tooltip: {
enabled: false
}
},
cutout: '70%'
}
});
canvas {
max-height: 100px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/3.7.1/chart.js"></script>
<canvas id="runningValue"></canvas>

(ApexCharts) How can I make the pie chart the same size?

My Problem : Chart size is fixed including legends.
I want to fixed pie chart size except legends.
How can I make the pie chart the same size?
This is my code.
Help me plz
var options = {
series: [25, 15, 44],
chart: {
type: 'pie',
**width: '300px'**
},
labels: ["Monday", "Tuesday", "Wednesday"],
theme: {
monochrome: {
enabled: true,
color: '#f38200',
shadeIntensity: 0.9
}
},
plotOptions: {
pie: {
size : "200px"
}
},
stroke: {
show: false
},
dataLabels: {
enabled: false
},
legend: {
position: 'bottom',
horizontalAlign: 'left',
markers: {
width: 9, height: 9
},
itemMargin: {
horizontal: 20, vertical: 0
},
formatter: function(seriesName, opts) {
~~~~~~~
return legend;
}
}
};
IMG - This is my problem
Try setting the legend width or height to a static value, e.g.
legend: {
width: 200
}
Try using -
legend: {
floating: true
}
and setting the legend's position using offsets.

Chart.js specific label next to point

I'm trying to get chartjs to show a specific label next to each point, for example in this script it should display "TRALALA" in the label as well as mouse hover, but instead it shows the coordinates.
How to have the specific label instead ?
https://jsfiddle.net/z0eLygwx/
thanks
var valuedata = [{
x: 3,
y: 5
}];
var valuelabel = ['TRALALA'];
var chartData = {
labels: valuelabel,
datasets: [{
label: 'Distance',
borderColor: '#2196f3', // Add custom color border
backgroundColor: '#2196f3', // Add custom color background (Points and Fill)
data: valuedata,
pointRadius: 10,
pointHoverRadius: 12
}]
};
var myBarChart = new Chart(document.getElementById("myChart1"), {
type: 'scatter',
data: {
labels: valuelabel,
datasets: [{
label: 'Distance',
borderColor: '#2196f3', // Add custom color border
backgroundColor: '#2196f3', // Add custom color background (Points and Fill)
data: valuedata,
pointRadius: 10,
pointHoverRadius: 12
}]
},
options: {
legend: {
display: true
},
title: {
display: true,
text: 'Distance of JDPT kanji compared to the equivalent JLPT level'
},
scales: {
yAxes: [{
type: 'logarithmic',
display: true,
scaleLabel: {
display: true,
labelString: 'Count',
fontSize: 16
}
}],
xAxes: [{
type: 'linear',
position: 'bottom',
display: true,
scaleLabel: {
display: true,
labelString: 'Distance',
fontSize: 16
},
gridLines: {
display: true
}
}]
},
plugins: {
datalabels: {
color: '#d6621e',
align: 'right',
offset: 16,
font: {
weight: 'bold'
}
}
}
}
});
myBarChart.update();
Ok I got it with
formatter: function(value, context) {
context.chart.data.labels[context.dataIndex];
}
For example
var myBarChart = new Chart(document.getElementById("bar-chart"), {
type: 'line',
data: {
labels: ['a', 'b'],
datasets: [{
data: [10, 20]
}]
},
options: {
plugins: {
datalabels: {
formatter: function(value, context) {
return context.chart.data.labels[context.dataIndex];
}
}
}
}
});

Highchart legend pagination on iphone

I have used highcharts in my iphone application, Everything works great except one is that when I click on pagination arrows of legend in highchart, it skips one page and goes to next page.
Say I have 4 pages, so if I am on 1st page right now and click to view another page then it jumps to 3rd page. After clicking next for 3rd page I go to 4th page and when I click on prev it skips 3rd page and jumps to 2nd page. And very important to take note is, its happening on iphone only not browser.
I am surprised to see this and unable to identify why this behaviour is there with pagination...
following is my code for creating highchart
var defaultBarChart = {
options: {
chart: {
type: 'column',
alignTicks:false,
//height: 250,
width: Constants.analyticChartWidth
},
yAxis: {
title: {
text: ''+$filter('translate')('values')
}
},
tooltip: {
enabled: false,
style: {
width: 200,
padding: 10,
lineHeight: "normal"
},
useHTML:true
},
legend: {
verticalAlign: 'bottom',
align: 'left',
x: 0,
itemStyle: {
width: deviceWidth,
'color':'#434f5a',
'font-size':'12px'
},
maxHeight: 105,
navigation: {
activeColor: '#3E576F',
animation: true,
arrowSize: 18,
inactiveColor: '#CCC'
}
},
},
title: {
text: ''
},
subtitle: {
text: ''
},
xAxis: {
categories: [
''
],
crosshair: true
},
tooltip: {
/* style: {
width: 100
}*/
enabled: false
},
/* tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true,
style: {
width: 100
}
},*/
series: [{
name: '',
data: [0],
showInLegend: false
}],
loading: false,
credits: {
enabled: false
}
};
I want to ask, if problem anywhere else other than navigation can affect on it?
Please.. help me to get out of this...!!

In Kendo UI DataViz, how do I place the labels inside the pie chart

Please refer to this example:
http://jsfiddle.net/mcLEb/
jQuery("#grid").kendoChart(
{
theme: jQuery(document).data("kendoSkin") || "default",
legend:
{
position: "bottom"
},
chartArea: {
height: 200
},
seriesDefaults:
{
labels:
{
visible: true,
format: "{0}%",
font: "12px Arial",
center: '5%'
}
},
series: [{
type: "pie",
data:[70,20,10]
}],
tooltip:
{
visible: false,
template: "${ category } - ${ value }%"
},
title: { padding: 1, margin: 1 },
seriesColors: ["#d15400", "#d2d2d2","#01619e"],
plotArea: { margin: { left: 50, right: 50 } },
});
More clarification:
Right now, the labels are located outside of the pie chart with an arrow pointing to their corresponding pie section. I want the labels themselves to be inside their corresponding pie section.
I am aware that a pie section could get smaller than the actual text inside of it, but I will handle that.
Thanks in advance!
use the code below (set position as "center")
seriesDefaults:
{
labels:
{
position: "center",
visible: true,
format: "{0}%",
font: "12px Arial",
}
}
The best way I have found to do this is using position insideEnd on the labels.
seriesDefaults:
{
labels:
{
position: "insideEnd",
visible: true,
format: "{0}%",
font: "12px Arial",
center: '5%'
}
}
Another way that was less reliable was to use a negative distance property on the labels.
seriesDefaults:
{
labels:
{
distance: -10,
visible: true,
format: "{0}%",
font: "12px Arial",
center: '5%'
}
}