Closed workingbuddy10 closed 1 month ago
I suggest using built-in buttons:
tooltip.setAll({
layout: root.horizontalLayout
});
var button = tooltip.label.children.unshift(am5.Button.new(root, {
//isMeasured: false,
centerX: am5.p100,
// width: 40,
// height: 20,
x: am5.p0,
y: am5.p0,
dx: -50,
label: am5.Label.new(root, {
text: "BT"
})
}));
button.events.on("click", function() {
console.log("Clicked");
});
Did exactly what you said @martynasma , but the button is not appearing : The codepen : https://codepen.io/Ansh-m-the-reactor/pen/JjQyrqB
You created a tooltip but did not assign it to valueAxis. So it's just an instance which is not used anywhere.
Try adding: valueAxis.set("tooltip", tooltip);
Genius @martynasma & @zeroin it worked!!
I am using the stock chart, where there is a movable tooltip with cursor on dateAxis and valueAxis.
Just adjacent to that I want to add a button too, and on clicking that we will create/initiate a horizontal line. This helps to create more accurate levels, at that price.
My concern is :
Codepen : https://codepen.io/Ansh-m-the-reactor/pen/JjQyrqB
How can we add a button ? Like this :
I just want a sticky button on the container of the tooltip of the valueAxis.