I want to define a variable that contains a variable. In this example the variable that I want to pass is "filldata".
I have tried passing it using $filldata as well as +filldata+.
if (fill == true) {
$filldata = "fill: true,";
} else {
$filldata = "fill: false,";
};
if (amount == true) {
var set1 = {
label: "Earnings",
id: "earnings",
data: data1,
points: {
show: true,
},
bars: {
show: false,
barWidth: 12,
aling: 'center'
},
lines: {
show: true,
$filldata
},
yaxis: 1
};
} else {
var set1 = "";
}
var a = b, b = c, c = 1;? I don't understand?..lines: {show: true, fill: fill}. Alternative you can assign the name and the value to variables (e.g.key = 'fill'; value = true) and dolines: {show: true, [key]: value}.$filldatain yoursetobject as you are now, why not just dofill: $filldataand set$filldatato true or false?if (amount == true)is the same asif (amount)