amcharts4 icon indicating copy to clipboard operation
amcharts4 copied to clipboard

Is there a way for amchat4 to reset when running a function?

Open hachaeyun opened this issue 5 months ago • 2 comments

Is there a way for amchat4 to reset when running a function?

I hope the event is reset

function fnHidePop(sGetName) {
   $("#" + sGetName).removeClass("on");                            
}  

If I run the above function, I hope the event reset or amchart4 I set up will be re-randomized.

============================================================================

These are the events I set up I want to get rid of how to get back to where I was before the click and the events I set as default

    imageSeriesTemplate.events.on("hit", function(event) {
        if (previousClickedCircle !== event.target) {
            if (previousClickedCircle) {           
                previousClickedCircle.fill = am4core.color("#0848b2");
                previousClickedCircle.stroke = am4core.color("#fff");
                previousClickedCircle.strokeWidth = 2; 
                previousClickedCircle.tooltipHTML =  "";    
                previousClickedCircle.showTooltipOn = "hover";          
            }        
            circle.tooltipHTML = "";
            console.log(event.target.dataItem.dataContext.id);
            gps_it(event.target.dataItem.dataContext.id);     
            event.target.tooltip = "";
            event.target.background.fill = am4core.color("#fff");
            event.target.fill = am4core.color("#ff6600");
            event.target.stroke = am4core.color("#ff6600");
            event.target.strokeWidth = 10;
            previousClickedCircle = event.target; 
            event.target.tooltipHTML = "<a class='circleBtn'"+ "onclick=" + "gps_it('{id}','')" +">{title} </a>";
            event.target.showTooltipOn = 'always';      
            event.target.series.chart.zoomToMapObject(event.target);
            event.target.zIndex = 1000;
            chart.invalidate();            
        }
    }, this);

imageSeries.events.on("datavalidated", function (event) {
  imageSeries.dataItems.each(function (dataItem) {
    var mapImage = event.target.dataItem;
    if (dataItem.dataContext.id === "id") {
                   var mapImage = dataItem.mapObject;
                   var circle = mapImage.children.getIndex(0); 
                   circle.zIndex = 1000;   
                   circle.tooltip = "";
                   circle.tooltip.keepTargetHover = true;
                   circle.tooltipHTML = "<a class='circleBtn'"+ "onclick=" + "gps_it('{id}','')" +">{title} </a>";
                   circle.showTooltipOn = 'always';                      
    }                 
  });
});  

hachaeyun avatar Jan 24 '24 09:01 hachaeyun