I'm in the process of creating a graph featuring bars with distinct data, color-coded for clarity. The legend explains the meaning behind each color. My goal is to implement a feature where clicking on a circle in the legend will highlight bars of the corresponding color on the graph.
<!DOCTYPE html>
<html>
<head>
<meta>
<meta name="description" content="Visualizing Resource Allocation per Project with Bar Graphs" />
<meta charset="utf-8">
<title>Resource Distribution by Program</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style type="text/css">
h1 {
font-size: 35px;
color: darkblue;
font-family: Helvetica;
border-bottom-width: 3px;
border-bottom-style: dashed;
border-bottom-color: black;
}
h2 {
font-size: 20px;
color: darkred;
font-family: Helvetica;
margin-left: 900px;
margin-top: -40px;
margin-bottom: 70px
}
h3 {
font-size: 13px;
color: red;
font-weight: bold;
}
.label {
font-size: 20px;
color: darkgrey;
font-family: sans-serif;
border-bottom-width: 3px;
border-bottom-style: dashed;
border-bottom-color: black;
}
body {
background: linear-gradient(white, #a6a6a6);
}
.legend {
font-family: sans-serif;
font-size: 17px;
font-weight: normal;
}
Please ignore the wide formatting, it's optimized for a large touch screen display.
My query pertains to enabling the functionality where clicking on a circle in the legend results in highlighting bars of the same color (specifically the stroke) on the graph.
Many thanks in advance!