react-native-charts-wrapper yOffset in yAxis not working - react-native

I'm trying to use this option, but it has no effect, and when I take a look at react-native-charts-wrapper code, I think maybe it is not correct.
In file ChartBaseManager.java, the setCommonAxisConfig function is only called for xAxis, but never called for yAxis. I'm a newbie at react native and java, so I don't understand all the code.
Maybe is this the reason for not working yOffset in y axis or I'm doing something wrong?
I'm using Line chart and my configuration is:
this.state = {
data: {
dataSets: [
{
values: [getDefaultPoint()],
label: "Teste",
config: {
drawCircleHole: false,
drawCircles: false,
drawValues: false,
lineWidth: 2,
barSpace: 0.2,
shadowWidth: 0.5,
shadowColor: processColor("white"),
shadowColorSameAsCandle: true,
neutralColor: processColor("white"),
decreasingColor: processColor("red"),
decreasingPaintStyle: "fill",
increasingColor: processColor("green"),
increasingPaintStyle: "fill",
color: processColor("#50E3C2"),
drawFilled: true,
fillGradient: {
colors: [processColor("#3F4969"), processColor("#313347")],
positions: [0, 0.5],
angle: 90,
orientation: "LEFT_RIGHT"
},
fillAlpha: 200
}
}
]
},
legend: { enabled: false },
marker: {
digits: this.props.markerDigits,
enabled: true,
backgroundTint: processColor("blue"),
markerColor: processColor("#F0C0FF8C"),
textColor: processColor("white"),
textSize: Math.round(14 * EStyleSheet.value("$scale"))
},
xAxis: {
drawGridLines: false,
drawAxisLine: true,
drawLabels: true,
position: "BOTTOM",
textColor: processColor("white"),
valueFormatter: "date",
valueFormatterPattern: "HH:mm",
avoidFirstLastClipping: true,
textSize: 12 * EStyleSheet.value("$scale"),
axisLineColor: processColor("#50E3C2"),
gridColor: processColor(EStyleSheet.value("$chartGridLineColor")),
granularity: 1,
granularityEnabled: true,
yOffset: 5
},
yAxis: {
right: {
enabled: false
},
left: {
enabled: true,
valueFormatter: this.props.yValueFormatterPattern,
textColor: processColor("white"),
drawGridLines: true,
gridLineWidth: 1,
drawAxisLine: false,
drawLabels: true,
labelCount: 4,
labelCountForce: true,
yOffset: -5,
position: "INSIDE_CHART",
textSize: 10
}
},
chart: {
drawGridBackground: false,
autoScaleMinMaxEnabled: true,
touchEnabled: this.props.touchEnabled,
dragEnabled: true,
scaleEnabled: true,
scaleXEnabled: true,
scaleYEnabled: true,
pinchZoom: true,
doubleTapToZoomEnabled: true,
dragDecelerationEnabled: true,
dragDecelerationFrictionCoef: 0.99,
keepPositionOnRotation: false,
viewPortOffsets: {
left: this.props.viewPortLeftOffset,
top: this.props.viewPortTopOffset,
right: this.props.viewPortRightOffset,
bottom: this.props.viewPortBottomOffset
}
}
};
...
<LineChart
style={styles.chart}
data={this.state.data}
chartDescription={{ text: "" }}
legend={this.state.legend}
marker={this.state.marker}
xAxis={this.state.xAxis}
yAxis={this.state.yAxis}
{...this.state.chart}
/>
But if I place "yOffset: -5" in xAxis configuration, the offset is applied to labels.
Anyone has the same problem using this option in yAxis?

I tried moving configs out of state but get the same result, so I created a new app and used the code of LineChartGradientScreen.js of react-native-charts-wrapper examples and configured yAxis with options below.
No matter what value I put in yOffset, the labels always stay in same place
I want to put the labels above grid lines.
My example app code:
import React from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
processColor,
} from 'react-native';
import {LineChart} from 'react-native-charts-wrapper';
const greenBlue = 'rgb(26, 182, 151)';
const petrel = 'rgb(59, 145, 153)';
const App: () => React$Node = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<View style={styles.body}>
<LineChart
style={styles.chart}
data={{
dataSets: [
{
values: [
{
y: 65,
x: 0,
marker: '65 kg',
},
{
y: 77,
x: 1,
marker: '77 kg',
},
{
y: 76,
x: 2,
marker: '76 kg',
},
{
y: 74,
x: 3,
marker: '74 kg',
},
{
y: 76,
x: 4,
marker: '76 kg',
},
{
y: 65,
x: 5,
marker: 'Today: 65 kg',
},
],
label: '',
config: {
mode: 'CUBIC_BEZIER',
drawValues: false,
lineWidth: 2,
drawCircles: true,
circleColor: processColor(petrel),
drawCircleHole: false,
circleRadius: 5,
highlightColor: processColor('transparent'),
color: processColor(petrel),
drawFilled: true,
fillGradient: {
colors: [processColor(petrel), processColor(greenBlue)],
positions: [0, 0.5],
angle: 90,
orientation: 'TOP_BOTTOM',
},
fillAlpha: 1000,
valueTextSize: 15,
},
},
{
values: [
{
y: 35,
x: 0,
marker: '35 kg',
},
{
y: 47,
x: 1,
marker: '47 kg',
},
{
y: 46,
x: 2,
marker: '46 kg',
},
{
y: 44,
x: 3,
marker: '44 kg',
},
{
y: 46,
x: 4,
marker: '46 kg',
},
{
y: 35,
x: 5,
marker: 'Today: 35 kg',
},
],
label: '',
config: {
mode: 'CUBIC_BEZIER',
drawValues: false,
lineWidth: 2,
drawCircles: true,
circleColor: processColor(petrel),
drawCircleHole: false,
circleRadius: 5,
highlightColor: processColor('transparent'),
color: processColor(petrel),
drawFilled: true,
fillGradient: {
colors: [processColor('red'), processColor('yellow')],
positions: [0, 0.5],
angle: 90,
orientation: 'TOP_BOTTOM',
},
fillAlpha: 1000,
valueTextSize: 15,
},
},
],
}}
chartDescription={{text: ''}}
legend={{
enabled: false,
}}
marker={{
enabled: true,
markerColor: processColor('white'),
textColor: processColor('black'),
}}
xAxis={{
enabled: true,
granularity: 1,
drawLabels: true,
position: 'BOTTOM',
drawAxisLine: true,
drawGridLines: false,
fontFamily: 'HelveticaNeue-Medium',
fontWeight: 'bold',
textSize: 12,
textColor: processColor('gray'),
valueFormatter: ['M', 'T', 'W', 'T', 'F', 'S'],
}}
yAxis={{
left: {
enabled: true,
textColor: processColor('white'),
drawGridLines: true,
gridLineWidth: 1,
drawAxisLine: false,
drawLabels: true,
yOffset: -5,
position: 'INSIDE_CHART',
textSize: 10,
gridColor: processColor('white'),
},
right: {
enabled: false,
},
}}
autoScaleMinMaxEnabled={true}
animation={{
durationX: 0,
durationY: 1500,
easingY: 'EaseInOutQuart',
}}
drawGridBackground={false}
drawBorders={false}
touchEnabled={true}
dragEnabled={false}
scaleEnabled={false}
scaleXEnabled={false}
scaleYEnabled={false}
pinchZoom={false}
doubleTapToZoomEnabled={false}
dragDecelerationEnabled={true}
dragDecelerationFrictionCoef={0.99}
keepPositionOnRotation={false}
/>
</View>
</SafeAreaView>
</>
);
};
const styles = StyleSheet.create({
scrollView: {
backgroundColor: 'black',
},
body: {
backgroundColor: 'black',
},
chart: {
height: 250,
},
});
export default App;

Related

How to hanlde async data with vue-echarts?

I am using vue-echarts along with Apache eCharts.
But I do not know how to load async data values.
I have looked through the examples in the docs and I still can't figure it out.
Can anyone take a look at this SFC and tell me how to update the data value inside the gaugeOption ref?
Currently the gaugeData array loads with a value of 0 and stays that way even though props.totalScore gets updated with a new value.
<template>
<vue-echarts
class="echart-container"
autoresize
:option="gaugeOption"
/>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
const props = defineProps({
totalScore: {
type: Number,
required: true,
},
reportDate: {
type: String,
required: true,
},
});
const gaugeData = [
{
value: props.totalScore,
},
];
const gaugeOption = ref({
series: [
{
emphasis: {
disabled: true,
},
data: gaugeData,
type: 'gauge',
startAngle: 180,
endAngle: 0,
min: 0,
max: 100,
splitNumber: 3,
radius: '95%',
center: ['50%', '95%'],
pointer: {
icon: 'circle',
length: '12%',
width: 50,
offsetCenter: [0, '-90%'],
itemStyle: {
color: '#FFFFFF',
borderColor: scoreHexColor,
borderWidth: 5,
shadowColor: 'rgba(10, 31, 68, 0.5)',
shadowBlur: 2,
shadowOffsetY: 0.1,
},
},
axisLine: {
show: true,
roundCap: true,
lineStyle: {
width: 10,
color: [
[0.48, '#ee6352'],
[0.52],
[0.66, '#ff8b3b'],
[0.7],
[0.83, '#fac05e'],
[0.87],
[1, '#59cd90'],
],
},
},
axisTick: {
length: 2,
lineStyle: {
color: '#8a94a6',
width: 2,
},
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
title: {
show: false,
},
detail: {
rich: {
header: {
fontSize: 36,
fontWeight: 700,
fontFamily: 'Open Sans',
color: '#0a1f44',
},
subHeader: {
fontSize: 16,
fontWeight: 400,
fontFamily: 'Open Sans',
color: '#8a94a6',
},
},
formatter: (value: number) => {
return `{header|${value}}\n{subHeader|${props.reportDate}}`;
},
offsetCenter: [0, '-20%'],
valueAnimation: true,
},
},
],
});
</script>
<style lang="scss" scoped>
.echart-container {
height: 300px;
max-width: 300px;
margin-top: -135px;
}
</style>
EDIT UPDATE:
I can now get the chart to load correctly using another ref and a watch of the props.
But when the props change it draws a new number ON TOP of the old one. But I need it to replace the old number.
See here how it looks on page load (this is correct):
And see here how it looks when I try to change the gaugeDataRef value (this is wrong, the value is drawn on top of the old one):
Here is the updated code:
import { computed, ref, watch } from 'vue';
const props = defineProps({
totalScore: {
type: Number,
required: true,
},
reportDate: {
type: String,
required: true,
},
});
const gaugeDataRef = ref<number[]>([]);
watch(props, () => {
gaugeDataRef.value.slice(0, 1);
gaugeDataRef.value.push(props.totalScore);
});
const gaugeOption = ref({
series: [
{
emphasis: {
disabled: true,
},
data: gaugeDataRef.value,
type: 'gauge',
startAngle: 180,
endAngle: 0,
min: 0,
max: 100,
splitNumber: 3,
radius: '95%',
center: ['50%', '95%'],
pointer: {
icon: 'circle',
length: '12%',
width: 50,
offsetCenter: [0, '-90%'],
itemStyle: {
color: '#FFFFFF',
borderColor: scoreHexColor,
borderWidth: 5,
shadowColor: 'rgba(10, 31, 68, 0.5)',
shadowBlur: 2,
shadowOffsetY: 0.1,
},
},
axisLine: {
show: true,
roundCap: true,
lineStyle: {
width: 10,
color: [
[0.48, '#ee6352'],
[0.52],
[0.66, '#ff8b3b'],
[0.7],
[0.83, '#fac05e'],
[0.87],
[1, '#59cd90'],
],
},
},
axisTick: {
length: 2,
lineStyle: {
color: '#8a94a6',
width: 2,
},
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
title: {
show: false,
},
detail: {
rich: {
header: {
fontSize: 36,
fontWeight: 700,
fontFamily: 'Open Sans',
color: '#0a1f44',
},
subHeader: {
fontSize: 16,
fontWeight: 400,
fontFamily: 'Open Sans',
color: '#8a94a6',
},
},
formatter: (value: number) => {
return `{header|${value}}\n{subHeader|${props.reportDate}}`;
},
offsetCenter: [0, '-20%'],
valueAnimation: true,
},
},
],
});
Figured it out.
I needed to add a watch on the props that first clears the array and then adds the new value back into the array.
import { computed, ref, watch } from 'vue';
const props = defineProps({
totalScore: {
type: Number,
required: true,
},
reportDate: {
type: String,
required: true,
},
});
const gaugeDataRef = ref<number[]>([]);
watch(props, () => {
gaugeDataRef.value.slice(0, 1);
gaugeDataRef.value.push(props.totalScore);
});
const gaugeOption = ref({
series: [
{
emphasis: {
disabled: true,
},
data: gaugeDataRef.value,
type: 'gauge',
startAngle: 180,
endAngle: 0,
min: 0,
max: 100,
splitNumber: 3,
radius: '95%',
center: ['50%', '95%'],
pointer: {
icon: 'circle',
length: '12%',
width: 50,
offsetCenter: [0, '-90%'],
itemStyle: {
color: '#FFFFFF',
borderColor: scoreHexColor,
borderWidth: 5,
shadowColor: 'rgba(10, 31, 68, 0.5)',
shadowBlur: 2,
shadowOffsetY: 0.1,
},
},
axisLine: {
show: true,
roundCap: true,
lineStyle: {
width: 10,
color: [
[0.48, '#ee6352'],
[0.52],
[0.66, '#ff8b3b'],
[0.7],
[0.83, '#fac05e'],
[0.87],
[1, '#59cd90'],
],
},
},
axisTick: {
length: 2,
lineStyle: {
color: '#8a94a6',
width: 2,
},
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
title: {
show: false,
},
detail: {
rich: {
header: {
fontSize: 36,
fontWeight: 700,
fontFamily: 'Open Sans',
color: '#0a1f44',
},
subHeader: {
fontSize: 16,
fontWeight: 400,
fontFamily: 'Open Sans',
color: '#8a94a6',
},
},
formatter: (value: number) => {
return `{header|${value}}\n{subHeader|${props.reportDate}}`;
},
offsetCenter: [0, '-20%'],
valueAnimation: true,
},
},
],
});
import { computed, ref, watch } from 'vue';
const props = defineProps({
totalScore: {
type: Number,
required: true,
},
reportDate: {
type: String,
required: true,
},
});
const gaugeDataRef = ref<number[]>([]);
watch(props, () => {
gaugeDataRef.value.slice(0, 1);
gaugeDataRef.value.push(props.totalScore);
});
const gaugeOption = ref({
series: [
{
emphasis: {
disabled: true,
},
data: gaugeDataRef.value,
type: 'gauge',
startAngle: 180,
endAngle: 0,
min: 0,
max: 100,
splitNumber: 3,
radius: '95%',
center: ['50%', '95%'],
pointer: {
icon: 'circle',
length: '12%',
width: 50,
offsetCenter: [0, '-90%'],
itemStyle: {
color: '#FFFFFF',
borderColor: scoreHexColor,
borderWidth: 5,
shadowColor: 'rgba(10, 31, 68, 0.5)',
shadowBlur: 2,
shadowOffsetY: 0.1,
},
},
axisLine: {
show: true,
roundCap: true,
lineStyle: {
width: 10,
color: [
[0.48, '#ee6352'],
[0.52],
[0.66, '#ff8b3b'],
[0.7],
[0.83, '#fac05e'],
[0.87],
[1, '#59cd90'],
],
},
},
axisTick: {
length: 2,
lineStyle: {
color: '#8a94a6',
width: 2,
},
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
title: {
show: false,
},
detail: {
rich: {
header: {
fontSize: 36,
fontWeight: 700,
fontFamily: 'Open Sans',
color: '#0a1f44',
},
subHeader: {
fontSize: 16,
fontWeight: 400,
fontFamily: 'Open Sans',
color: '#8a94a6',
},
},
formatter: (value: number) => {
return `{header|${value}}\n{subHeader|${props.reportDate}}`;
},
offsetCenter: [0, '-20%'],
valueAnimation: true,
},
},
],
});

ECharts unkown series undefined

I am trying to use echarts bar https://echarts.apache.org/examples/en/editor.html?c=bar-label-rotation&lang=ts for displaying data . The problem I have is when trying to add four different bars to a chart I get error: [ECharts] Unkown series undefined. It works fine when there is only one bar. Here is my code:
this.chartOptions = {
grid: {
top: 20,
bottom: 90,
right: 5,
left: 60
},
legend: {
data: [
'Positive Capacity'
'Negative Capacity'
'Positive Energy'
'Negative Energy'
]
},
tooltip: {
trigger: 'axis',
formatter: (val) => `
<div>${format.formatTime('dd.MM.yyyy hh:mm', val[0].data[0])}</div>
<div>${val[0].marker}<span style="float:right"> ${val[0].data[1]} kW</span></div>
`
},
xAxis: {
type: 'time',
name: this.chartTranslations.xAxis,
nameLocation: 'middle',
nameGap: 80,
axisLabel: {
rotate: 45,
formatter: (val) => format.formatTime('dd.MM.yy hh:mm', val)
}
},
yAxis: {
type: 'value',
name: this.chartTranslations.yAxis,
nameLocation: 'middle',
nameGap: 50,
scale: true,
boundaryGap: ['2%', '2%'],
axisLabel : {
formatter: (val) => this.isMegaWatts ? (val/1000 + ' MW') : (val + ' kW')
},
},
series: [
{
name: 'Positive Capacity'
type: 'bar',
barGap: 10,
emphasis: {
focus: 'series'
},
itemStyle: {
color: new graphic.LinearGradient(0, 0, 0, 2.5, [
{
offset: 0,
color: 'rgba(45, 159, 195, 1)'
},
{
offset: 1,
color: 'rgba(255, 255, 255, 0)'
}
])
},
data: this.positiveCapacity
},
{
name: 'Negative Capacity',
type: 'bar',
barGap: 10,
emphasis: {
focus: 'series'
},
itemStyle: {
color: new graphic.LinearGradient(5, 5, 0, 2.5, [
{
offset: 0,
color: 'rgba(45, 159, 195, 1)'
},
{
offset: 1,
color: 'rgba(255, 255, 255, 0)'
}
])
},
data: this.negativeCapacity
},
{
name: 'Positive Energy',
type: 'bar',
barGap: 10,
emphasis: {
focus: 'series'
},
itemStyle: {
color: new graphic.LinearGradient(10, 10, 0, 2.5, [
{
offset: 0,
color: 'rgba(45, 159, 195, 1)'
},
{
offset: 1,
color: 'rgba(255, 255, 255, 0)'
}
])
},
data: this.positiveEnergy
},
{
name: 'Positive Capacity',
type: 'bar',
barGap: 10,
emphasis: {
focus: 'series'
},
itemStyle: {
color: new graphic.LinearGradient(20, 20, 0, 2.5, [
{
offset: 0,
color: 'rgba(45, 159, 195, 1)'
},
{
offset: 1,
color: 'rgba(255, 255, 255, 0)'
}
])
},
data: this.negativeEnergy
}
]
};
Then later setting content with: Echarts.setOption(this.chartOptions);
Thanks for any help or insight.

chart js showing different width of bar

I am creating simple bar chart using Chartjs in Vue
<bar-chart
:data="[40, 19, 3, 5,]"
:labels="['0-30 days', '31-60 days', '61-90 days', '90+']"
:colors="['blue', 'blue', 'blue', 'blue']"
></bar-chart>
and the code for this is
createChart(chartData: object) {
const canvas = document.getElementById('bar') as HTMLCanvasElement;
const myopt = {
deferred: {
xOffset: '50%',
delay: 250,
},
plugins: {
datalabels: {
align: 'top',
anchor: 'end',
color: 'blue',
},
},
legend: {
display: true,
},
title: {
display: true,
text: 'Chart.js - Different Bar Colors',
},
tooltips: { enabled: true },
responsive: true,
hover: { mode: null },
elements: {
point: {
radius: 0,
},
},
scales: {
xAxes: [{
scaleLabel: {
display: true,
labelString: '',
},
offset: false,
color: 'rgba(0, 0, 0, 0)',
gridLines: {
drawOnChartArea: false,
},
}],
yAxes: [{
id: 'y-axis-0',
mirror: false,
stacked: true,
offset: false,
callback(label:any, index:any, labels:[]) {
return `${label}%`;
},
ticks: {
beginAtZero: true,
min: 0,
},
gridLines: {
display: true,
color: 'rgba(0, 0, 0, 0)',
drawOnChartArea: false,
},
}],
},
};
const options = {
type: 'bar',
data: chartData,
options: myopt,
};
new Chart(canvas, options);
}
the chart which this is generating is not equidistant sharing image for reference
position and width of the bar is incorrect and also I want to know if there is any way by which i can customize labels for y axis e.g. instead of 40,35,30... it will be ** 40k,35k,30k** in y axis
If any one has worked on this case please help
You can make use of the tick callback for your K at the end (https://www.chartjs.org/docs/latest/axes/labelling.html#creating-custom-tick-formats)
var ctx2 = document.getElementById("stack-chart");
var stackChart1 = new Chart(ctx2, {
type: 'bar',
options: {
scales: {
yAxes: [{
ticks: {
beginAtZero: true,
callback: (val) => (val + 'k')
}
}]
},
legend: {
display: false,
labels: {
fontSize: 20,
fontColor: '#595d6e',
}
},
tooltips: {
enabled: false
}
},
data: {
labels: ['1', '2', '3', '4', '5'],
datasets: [{
backgroundColor: "#5e63b4",
data: [20, 30, 40, 50, 60]
}]
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.js"></script>
<canvas id="stack-chart" width="1360" height="450"></canvas>

Increase width of Xaxis title in bar chart in highcharts

I am trying bar chart using Highcharts. In the below code we have xaxis categories like : ['Name1', 'Name2', 'Name3', 'Name4' ].
Firstly, I am using the below highcharts code in react native to develop iOS app.
I am trying to place the Name on each individual bar's in the graph(bar chart), which is working but when the name text from the categories array is v.large then the width of the title is not getting increased & the text is coming in multiple lines with the minimum width. If the name is v.large then only we are getting dotted text on the graph.
Can we increase the width of the title? and If so how can we increase the width within the iPhone's width.
chart: {
type: 'bar',
reflow: true,
marginRight: 30,
},
credits: {
enabled: false
},
title: {
align: "left",
text: "A comparison of the business’ digital health with that of the competitors.",
backgroundColor:'green',
style: {
color: '#808080',
fontWeight: '400',
fontSize: '13px',
}
},
xAxis: {
categories: ['Name1', 'Name2', 'Name3', 'Name4' ],
title: {
align: "left",
},
scrollbar: {
enabled: false
},
labels: {
x: 25,
y: -22,
align: 'left',
useHTML: true,
style: {
fontSize: '13px',
fontFamily: 'Open Sans',
color: '#464646',
backgroundColor: 'green',
},
},
},
yAxis: {
gridLineColor: "transparent",
stackLabels: {
qTotals: [91,99,85,99],
enabled: true,
useHTML: true,
style: {
fontWeight: "bold",
},
formatter: function () {
return this.options.qTotals[this.x];
},
},
tickInterval: 20,
labels: {
enabled: false
},
plotOptions: {
series: {
dataLabels: {
align: 'center',
enabled: false,
crop: false,
overflow: 'none',
verticalAlign: 'top',
y: -50,
style: {
fontWeight: '300',
color: '#808080',
fontSize: '30px',
}
},
pointWidth: 25,
borderWidth: 0,
pointPadding: 10,
stacking: "normal",
states: {
hover: {
enabled: false
}
},
//cursor: 'pointer',
point: {
events: {
click: function (event) {
}
}
}
}
},
series: [
{
name: "",
data: [3, 1, 15, 1],
color: "#f5f6f8",
dataLabels: {
enabled: false
},
},
{
name: "",
color: "#ff0000",
data: [{ y: 97, color: "#0f875a" }, { y: 99, color: "#0f875a" }, { y: 85, color: "#0f875a" }, { y: 99, color: "#0f875a" }]
}
],
}
For a sample I have taken a graph i.e bar chart from Highcharts, In the link jsfiddle.net/psre6Lj9/1 we have some fruits names, where 'Apples' width is not sufficient and the text is being displayed in multiple lines. I want to increase the width of the title. How can i do that.
To increase the width of the labels, set the right style:
xAxis: {
categories: ['Apples Apples Apples Apples Apples Apples Apples ', 'Oranges', 'Pears', 'Grapes', 'Bananas'],
labels: {
x: 25,
y: -22,
align: 'left',
style: {
width: '300px'
}
}
}
Live demo: https://jsfiddle.net/BlackLabel/went9xmf/
API: https://api.highcharts.com/highcharts/xAxis.labels.style

How to remove / customize yAxis from <Linechart> in react-native-wrapper

How can I remove yAxis from react-native-wrapper and also I want to have custom label at yAxis. As there is no proper documentation for react-native for each component of react-native-wrapper. I want Line chart to work like Gantt Chart.
constructor(props) {
super(props);
this.state = {
data: {
dataSets: [{
values: [{ y: 130 }, { y: 130 }, { y: 130 }, { y: 130 }, { y: 130 }],
label: 'Company Z',
valueTextColor:processColor('cyan'),
config: {
lineWidth: 1,
drawCubicIntensity: 0.4,
circleRadius: 5,
drawHighlightIndicators: false,
color: processColor('blue'),
drawFilled: true,
fillColor: processColor('blue'),
fillAlpha: 45,
circleColor: processColor('blue'),
textColor: processColor('cyan'),
}
}],
},
xAxis: {
valueFormatter: ['4 Jul', '5 Jul', '6 Jul', '7 Jul','8 Jul','9 Jul','10 Jul','11 Jul','12 Jul','13 Jul'],
textColor: processColor('red'),
},
yAxis: {
textSize:30
},
legend: {
enabled: true,
textColor: processColor('blue'),
textSize: 12,
position: 'BELOW_CHART_RIGHT',
form: 'SQUARE',
formSize: 14,
xEntrySpace: 10,
yEntrySpace: 5,
formToTextSpace: 5,
wordWrapEnabled: true,
maxSizePercent: 0.5,
custom: {
colors: [processColor('red')],
labels: []
}
},
marker: {
enabled: true,
backgroundTint: processColor('teal'),
markerColor: processColor('#F0C0FF8C'),
textColor: processColor('white'),
}
};
// if you want to listen on navigator events, set this up
this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
}
render(){
return(
<View style={styles.container}>
<LineChart
style={styles.chart}
data={this.state.data}
description={{ text: '1111111' }}
legend={this.state.legend}
marker={this.state.marker}
xAxis={this.state.xAxis}
drawGridBackground={true}
borderColor={processColor('teal')}
borderWidth={1}
drawBorders={true}
touchEnabled={true}
dragEnabled={true}
scaleEnabled={true}
scaleXEnabled={true}
scaleYEnabled={true}
pinchZoom={true}
doubleTapToZoomEnabled={true}
dragDecelerationEnabled={true}
dragDecelerationFrictionCoef={0.99}
keepPositionOnRotation={false}
onSelect={this.handleSelect.bind(this)}
/>
</View>
)
yAxis props
yAxis: PropTypes.shape({
left: PropTypes.shape(yAxisIface),
right: PropTypes.shape(yAxisIface)
}),
you can use like this
yAxis: {
left: {
axisLineColor: processColor(AXIS_LINE_COLOR),
gridColor: processColor(AXIS_LINE_COLOR),
labelCount: 6,
labelCountForce: true,
},
right: {
enabled: true,
drawLabels: false,
drawAxisLine: true,
axisLineColor: processColor(AXIS_LINE_COLOR),
drawGridLines: false,
}
}