Adding a Custom Legend Entry

559
0
02-22-2021 02:00 PM
MichaelCollins6
New Contributor II

I want to be able to add a custom legend entry that is a color ramp for a unique value renderer that is calculated off of a color range. I have several zip codes that are color coded based on a series of related values. Though the values are distinct in the renderer, they all come from the related ramp like that pictured.

MichaelCollins6_0-1614030912342.png

I think I might be close to success with the following code recommended by @RobertScheitlin__GISP, but ultimately the dom is re-rendered and it disappears.

 

watchUtils.when(legend, "container", function() {
    aspect.after(legend, "scheduleRender", function(response) {
        legendEntry.appendChild(legendTitle);
        legendEntry.appendChild(legendRow);
        
        legendRow.appendChild(legendRowSymbol);
        legendRowSymbol.appendChild(rampRow);
        rampRow.appendChild(rampHolder);
        rampHolder.appendChild(colorRamp);

        legendRow.appendChild(legendRowDescription);
        legendRowDescription.appendChild(labelHolder);

        labelHolder.appendChild(lowLabel);
        labelHolder.appendChild(highLabel);
        target.appendChild(legendEntry);
    });
});

 

Does anyone have any ideas how to get some extra elements to show up in the Legend widget without completely rewriting the widget?

 

Tags (3)
0 Kudos
0 Replies