Hello,
Here is the query variables, when I map the @ MOTIVO1 I want the value 6712 as graph category:
DECLARE @ MACHINE VARCHAR (15) = ‘MACHINE_07’;
DECLARE @ PRODLINE VARCHAR (15) = ‘PROD_LINE_01’;
DECLARE @ MOTIVO1 VARCHAR (15) = ‘6712’;
DECLARE @ MOTIVO2 VARCHAR (15) = ‘2618’;
DECLARE @ MOTIVO3 VARCHAR (15) = ‘2923’;
DECLARE @ MOTIVO4 VARCHAR (15) = ‘2941’;
Here ir the Graph Set-up:
let EIXO_X = ;
let Y1 = ;
let Y2 = ;
let Y3 = ;
let Y4 = ;
data.series.map((s) => {
EIXO_X = s.fields.find((f) => f.name === ‘HORA’).values;
Y1 = s.fields.find((f) => f.name === ‘MOTIVO1’).values;
Y2 = s.fields.find((f) => f.name === ‘MOTIVO2’).values;
Y3 = s.fields.find((f) => f.name === ‘MOTIVO3’).values;
Y4 = s.fields.find((f) => f.name === ‘MOTIVO4’).values;
});
var app = {};
const posList = [
‘left’,
‘right’,
‘top’,
‘bottom’,
‘inside’,
‘insideTop’,
‘insideLeft’,
‘insideRight’,
‘insideBottom’,
‘insideTopLeft’,
‘insideTopRight’,
‘insideBottomLeft’,
‘insideBottomRight’
];
app.configParameters = {
rotate: {
min: -90,
max: 90
},
align: {
options: {
left: ‘left’,
center: ‘center’,
right: ‘right’
}
},
verticalAlign: {
options: {
top: ‘top’,
middle: ‘middle’,
bottom: ‘bottom’
}
},
position: {
options: posList.reduce(function (map, pos) {
map[pos] = pos;
return map;
}, {})
},
distance: {
min: 0,
max: 100
}
};
app.config = {
rotate: 90,
align: ‘left’,
verticalAlign: ‘middle’,
position: ‘insideBottom’,
distance: 15,
onChange: function () {
const labelOption = {
rotate: app.config.rotate,
align: app.config.align,
verticalAlign: app.config.verticalAlign,
position: app.config.position,
distance: app.config.distance
};
myChart.setOption({
series: [
{
label: labelOption
},
{
label: labelOption
},
{
label: labelOption
},
{
label: labelOption
}
]
});
}
};
const labelOption = {
show: true,
position: app.config.position,
distance: app.config.distance,
align: app.config.align,
verticalAlign: app.config.verticalAlign,
rotate: app.config.rotate,
fontSize: 8,
rich: {
name: {}
}
};
return {
tooltip: {
trigger: ‘axis’,
axisPointer: {
type: ‘shadow’
}
},
legend: {
data: [replaceVariables(‘@ MOTIVO1’), ‘@ MOTIVO2’, ‘@ MOTIVO3’, ‘@ MOTIVO4’]
},
toolbox: {
show: true,
orient: ‘vertical’,
left: ‘right’,
top: ‘center’,
feature: {
mark: { show: true },
dataView: { show: true, readOnly: false },
magicType: { show: true, type: [‘line’, ‘bar’, ‘stack’] },
restore: { show: true },
saveAsImage: { show: true }
}
},
xAxis: [
{
type: ‘category’,
axisTick: { show: false },
data: EIXO_X
}
],
yAxis: [
{
type: ‘value’
}
],
series: [
{
name: replaceVariables(“@ MOTIVO1”),
type: ‘bar’,
barGap: 0,
label: labelOption,
emphasis: {
focus: ‘series’
},
data: Y1
},
{
name: ‘@ MOTIVO2’,
type: ‘bar’,
label: labelOption,
emphasis: {
focus: ‘series’
},
data: Y2
},
{
name: ‘@ MOTIVO3’,
type: ‘bar’,
label: labelOption,
emphasis: {
focus: ‘series’
},
data: Y3
},
{
name: ‘@ MOTIVO4’,
type: ‘bar’,
label: labelOption,
emphasis: {
focus: ‘series’
},
data: Y4
}
]
};