Set svg animate's attribute from css - css

I have an SVG animation, I want to set animate tags attribute from and to using css.
like:
animate{
from: #f7f7f7;
to: #33d424;
}
Is this possible, how can I do that ?
Here is my SVG code:
<svg width='100px' height='100px' xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid" class="uil-squares">
<rect x="0" y="0" width="100" height="100" fill="none" class="bk"></rect>
<rect x="15" y="15" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.0s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="40" y="15" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.125s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="65" y="15" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.25s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="15" y="40" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.875s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="65" y="40" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.375" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="15" y="65" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.75s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="40" y="65" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.625s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
<rect x="65" y="65" width="20" height="20" fill="#f7f7f7" class="sq">
<animate attributeName="fill" from="#f7f7f7" to="#33d424" repeatCount="indefinite" dur="1s" begin="0.5s" values="#33d424;#33d424;#f7f7f7;#f7f7f7" keyTimes="0;0.1;0.2;1"></animate>
</rect>
</svg>

You would have to use CSS animations instead of SVG ones. Something like this:
http://jsfiddle.net/scarl3tt/g2frngcn/
#keyframes animate {
0% {
fill: #f7f7f7;
}
6.25% {
fill: #33d424;
}
12.5% {
fill: #f7f7f7;
}
}
You also need to delay each element's animation to make them run in sequence. I wrote this in pure CSS because I'm not sure how familiar you are with SASS/LESS, but using a preprocessor and an autoprefixer makes this kind of thing a lot easier.

Related

identify selector by index

I want to use the robot framework to automate the user action to hover on bar chart.
Is there a way to identify the bar chart by index?
or what should be the selector for me to use the robot framework to hover on the first bar chart?
I could not find a unique element when inspecting the chart.
outerHTML
<div class="recharts-responsive-container" width="1557" height="150" style="outline: green dotted 2px !important;">
<div class="recharts-wrapper" style="position: relative; cursor: default; width: 1557px; height: 150px;">
<svg class="recharts-surface" width="1557" height="150" viewBox="0 0 1557 150" version="1.1" style="">
<defs>
<clipPath id="recharts3-clip" style="">
<rect x="80" y="0" height="100" width="1457"></rect>
</clipPath>
</defs>
<g class="recharts-layer recharts-bar">
<g class="recharts-layer recharts-bar-rectangles">
<g class="recharts-layer">
<g class="recharts-layer recharts-bar-rectangle" style="">
<path width="233" height="5" x="109.14" y="95" cursor="pointer" fill="rgba(191, 60, 175, 0.7)" stroke="rgba(191, 60, 175, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 109.14,95 h 233 v 5 h -233 Z" style=""></path>
</g>
<g class="recharts-layer recharts-bar-rectangle" style="">
<path width="233" height="6.818181818181813" x="400.53999999999996" y="93.18181818181819" cursor="pointer" fill="rgba(254, 75, 131, 0.7)" stroke="rgba(254, 75, 131, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 400.53999999999996,93.18181818181819 h 233 v 6.818181818181813 h -233 Z"></path>
</g>
<g class="recharts-layer recharts-bar-rectangle">
<path width="233" height="19.545454545454547" x="691.9399999999999" y="80.45454545454545" cursor="pointer" fill="rgba(255, 120, 71, 0.7)" stroke="rgba(255, 120, 71, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 691.9399999999999,80.45454545454545 h 233 v 19.545454545454547 h -233 Z"></path>
</g>
<g class="recharts-layer recharts-bar-rectangle">
<path width="233" height="17.72727272727272" x="983.3399999999999" y="82.27272727272728" cursor="pointer" fill="rgba(226, 183, 47, 0.7)" stroke="rgba(226, 183, 47, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 983.3399999999999,82.27272727272728 h 233 v 17.72727272727272 h -233 Z"></path>
</g>
<g class="recharts-layer recharts-bar-rectangle">
<path width="233" height="92.27272727272728" x="1274.74" y="7.7272727272727195" cursor="pointer" fill="rgba(175, 240, 91, 0.7)" stroke="rgba(175, 240, 91, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 1274.74,7.7272727272727195 h 233 v 92.27272727272728 h -233 Z"></path>
</g>
</g>
</g>
</g>
<g class="recharts-cartesian-grid">
<g class="recharts-cartesian-grid-horizontal">
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="100" x2="1537" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="50" x2="1537" y2="50"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="0" x2="1537" y2="0"></line>
</g>
<g class="recharts-cartesian-grid-vertical">
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="225.7" y1="0" x2="225.7" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="517.0999999999999" y1="0" x2="517.0999999999999" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="808.5" y1="0" x2="808.5" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="1099.8999999999999" y1="0" x2="1099.8999999999999" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="1391.3" y1="0" x2="1391.3" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="0" x2="80" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="1537" y1="0" x2="1537" y2="100"></line>
</g>
</g>
<g class="recharts-layer recharts-cartesian-axis recharts-xAxis xAxis">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-line" stroke="#666" fill="none" x1="80" y1="100" x2="1537" y2="100" style=""></line>
<g class="recharts-cartesian-axis-ticks">
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="225.7" y1="106" x2="225.7" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="225.7" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="225.7" dy="0.71em">0.00-0.20</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="517.0999999999999" y1="106" x2="517.0999999999999" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="517.0999999999999" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="517.0999999999999" dy="0.71em">0.20-0.40</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="808.5" y1="106" x2="808.5" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="808.5" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="808.5" dy="0.71em">0.40-0.60</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="1099.8999999999999" y1="106" x2="1099.8999999999999" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="1099.8999999999999" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="1099.8999999999999" dy="0.71em">0.60-0.80</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="1391.3" y1="106" x2="1391.3" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="1391.3" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="1391.3" dy="0.71em">0.80-1.00</tspan>
</text>
</g>
</g>
<text offset="5" x="808.5" y="135" class="recharts-text recharts-label" text-anchor="middle">
<tspan x="808.5" dy="0.71em">Range of Word Confidence Scores</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis recharts-yAxis yAxis" style="">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-line" stroke="#666" fill="none" x1="80" y1="0" x2="80" y2="100"></line>
<g class="recharts-cartesian-axis-ticks">
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="74" y1="100" x2="80" y2="100"></line>
<text orientation="left" width="60" height="100" type="number" x="72" y="100" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="end">
<tspan x="72" dy="0.355em">0</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="74" y1="50" x2="80" y2="50"></line>
<text orientation="left" width="60" height="100" type="number" x="72" y="50" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="end">
<tspan x="72" dy="0.355em">110</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="74" y1="0" x2="80" y2="0"></line>
<text orientation="left" width="60" height="100" type="number" x="72" y="11" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="end">
<tspan x="72" dy="0.355em">220</tspan>
</text>
</g>
</g>
<text x="-100" y="40" width="100" transform="rotate(-90)" class="recharts-text" text-anchor="start">
<tspan x="-100" dy="-2em">Count of Word</tspan>
<tspan x="-100" dy="1em">Confidence</tspan>
<tspan x="-100" dy="1em">Scores</tspan>
</text>
</g>
</svg>
<div class="recharts-tooltip-wrapper recharts-tooltip-wrapper-right recharts-tooltip-wrapper-top" style="pointer-events: none; visibility: hidden; position: absolute; top: 0px; left: 0px; transform: translate(235.7px, 32px);">
<div class="recharts-default-tooltip" style="margin: 0px; padding: 10px; background-color: rgb(255, 255, 255); border: 1px solid rgb(204, 204, 204); white-space: nowrap;">
<p class="recharts-tooltip-label" style="">0.00-0.20</p>
</div>
</div>
</div>
</div>
The first bar of the five can be selected in CSS by:
.recharts-layer.recharts-bar-rectangle:first-child:hover
To demonstrate this, this snippet changes the path's fill color to blue on hover of the bar.
.recharts-layer.recharts-bar-rectangle:first-child:hover path {
fill: blue;
}
<div class="recharts-responsive-container" width="1557" height="150" style="outline: green dotted 2px !important;">
<div class="recharts-wrapper" style="position: relative; cursor: default; width: 1557px; height: 150px;">
<svg class="recharts-surface" width="1557" height="150" viewBox="0 0 1557 150" version="1.1" style="">
<defs>
<clipPath id="recharts3-clip" style="">
<rect x="80" y="0" height="100" width="1457"></rect>
</clipPath>
</defs>
<g class="recharts-layer recharts-bar">
<g class="recharts-layer recharts-bar-rectangles">
<g class="recharts-layer">
<g class="recharts-layer recharts-bar-rectangle" style="">
<path width="233" height="5" x="109.14" y="95" cursor="pointer" fill="rgba(191, 60, 175, 0.7)" stroke="rgba(191, 60, 175, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 109.14,95 h 233 v 5 h -233 Z" style=""></path>
</g>
<g class="recharts-layer recharts-bar-rectangle" style="">
<path width="233" height="6.818181818181813" x="400.53999999999996" y="93.18181818181819" cursor="pointer" fill="rgba(254, 75, 131, 0.7)" stroke="rgba(254, 75, 131, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 400.53999999999996,93.18181818181819 h 233 v 6.818181818181813 h -233 Z"></path>
</g>
<g class="recharts-layer recharts-bar-rectangle">
<path width="233" height="19.545454545454547" x="691.9399999999999" y="80.45454545454545" cursor="pointer" fill="rgba(255, 120, 71, 0.7)" stroke="rgba(255, 120, 71, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 691.9399999999999,80.45454545454545 h 233 v 19.545454545454547 h -233 Z"></path>
</g>
<g class="recharts-layer recharts-bar-rectangle">
<path width="233" height="17.72727272727272" x="983.3399999999999" y="82.27272727272728" cursor="pointer" fill="rgba(226, 183, 47, 0.7)" stroke="rgba(226, 183, 47, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 983.3399999999999,82.27272727272728 h 233 v 17.72727272727272 h -233 Z"></path>
</g>
<g class="recharts-layer recharts-bar-rectangle">
<path width="233" height="92.27272727272728" x="1274.74" y="7.7272727272727195" cursor="pointer" fill="rgba(175, 240, 91, 0.7)" stroke="rgba(175, 240, 91, 0.7)" stroke-width="2" radius="0" class="recharts-rectangle" d="M 1274.74,7.7272727272727195 h 233 v 92.27272727272728 h -233 Z"></path>
</g>
</g>
</g>
</g>
<g class="recharts-cartesian-grid">
<g class="recharts-cartesian-grid-horizontal">
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="100" x2="1537" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="50" x2="1537" y2="50"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="0" x2="1537" y2="0"></line>
</g>
<g class="recharts-cartesian-grid-vertical">
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="225.7" y1="0" x2="225.7" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="517.0999999999999" y1="0" x2="517.0999999999999" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="808.5" y1="0" x2="808.5" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="1099.8999999999999" y1="0" x2="1099.8999999999999" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="1391.3" y1="0" x2="1391.3" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="80" y1="0" x2="80" y2="100"></line>
<line stroke="#ccc" stroke-dasharray="3 3" fill="none" x="80" y="0" width="1457" height="100" offset="[object Object]" x1="1537" y1="0" x2="1537" y2="100"></line>
</g>
</g>
<g class="recharts-layer recharts-cartesian-axis recharts-xAxis xAxis">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-line" stroke="#666" fill="none" x1="80" y1="100" x2="1537" y2="100" style=""></line>
<g class="recharts-cartesian-axis-ticks">
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="225.7" y1="106" x2="225.7" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="225.7" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="225.7" dy="0.71em">0.00-0.20</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="517.0999999999999" y1="106" x2="517.0999999999999" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="517.0999999999999" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="517.0999999999999" dy="0.71em">0.20-0.40</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="808.5" y1="106" x2="808.5" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="808.5" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="808.5" dy="0.71em">0.40-0.60</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="1099.8999999999999" y1="106" x2="1099.8999999999999" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="1099.8999999999999" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="1099.8999999999999" dy="0.71em">0.60-0.80</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="bottom" width="1457" height="30" type="category" x="80" y="100" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="1391.3" y1="106" x2="1391.3" y2="100"></line>
<text orientation="bottom" width="1457" height="30" type="category" x="1391.3" y="108" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="middle">
<tspan x="1391.3" dy="0.71em">0.80-1.00</tspan>
</text>
</g>
</g>
<text offset="5" x="808.5" y="135" class="recharts-text recharts-label" text-anchor="middle">
<tspan x="808.5" dy="0.71em">Range of Word Confidence Scores</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis recharts-yAxis yAxis" style="">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-line" stroke="#666" fill="none" x1="80" y1="0" x2="80" y2="100"></line>
<g class="recharts-cartesian-axis-ticks">
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="74" y1="100" x2="80" y2="100"></line>
<text orientation="left" width="60" height="100" type="number" x="72" y="100" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="end">
<tspan x="72" dy="0.355em">0</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="74" y1="50" x2="80" y2="50"></line>
<text orientation="left" width="60" height="100" type="number" x="72" y="50" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="end">
<tspan x="72" dy="0.355em">110</tspan>
</text>
</g>
<g class="recharts-layer recharts-cartesian-axis-tick">
<line orientation="left" width="60" height="100" type="number" x="20" y="0" class="recharts-cartesian-axis-tick-line" stroke="#666" fill="none" x1="74" y1="0" x2="80" y2="0"></line>
<text orientation="left" width="60" height="100" type="number" x="72" y="11" stroke="none" fill="#666" class="recharts-text recharts-cartesian-axis-tick-value" text-anchor="end">
<tspan x="72" dy="0.355em">220</tspan>
</text>
</g>
</g>
<text x="-100" y="40" width="100" transform="rotate(-90)" class="recharts-text" text-anchor="start">
<tspan x="-100" dy="-2em">Count of Word</tspan>
<tspan x="-100" dy="1em">Confidence</tspan>
<tspan x="-100" dy="1em">Scores</tspan>
</text>
</g>
</svg>
<div class="recharts-tooltip-wrapper recharts-tooltip-wrapper-right recharts-tooltip-wrapper-top" style="pointer-events: none; visibility: hidden; position: absolute; top: 0px; left: 0px; transform: translate(235.7px, 32px);">
<div class="recharts-default-tooltip" style="margin: 0px; padding: 10px; background-color: rgb(255, 255, 255); border: 1px solid rgb(204, 204, 204); white-space: nowrap;">
<p class="recharts-tooltip-label" style="">0.00-0.20</p>
</div>
</div>
</div>
</div>
You can of course add even more selectivity by adding more ancestors' classes.

How to animate pattern items sequentially?

<svg viewbox="0 0 100 100">
<defs>
<pattern
id="dotted-pattern"
viewbox="0,0,100,100"
height="3.125%"
width="3.125%">
<circle cx="50" cy="50" fill="#10446D" r="12">
<animate
attributeName="opacity"
values="0; 1"
keyTimes="0; 1"
dur="1s"
begin="0s"
repeatCount="1"
fill="freeze" />
</circle>
</pattern>
<mask id="circle-mask" maskContentUnits="userSpaceOnUse" maskUnits="userSpaceOnUse">
<circle cx="50" cy="50" r="38.48" width="100" height="100" fill="white"></circle>
</mask>
</defs>
<rect
width="74"
height="74"
y="13"
x="13"
mask="url(#circle-mask)"
fill="url(#dotted-pattern)"></rect>
</svg>
This way animation runs simultaneously for all pattern items.
How to run this sequentially? Start next item animation if the previous one completed?
Instead of animating the circles of the pattern I would animate a radial gradient from white to black, and I would use this gradient to fill the mask circle like so:
<svg viewbox="0 0 100 100">
<defs>
<radialGradient id="rg" cx=".5" cy=".5" r="0.01">
<stop offset="0%" stop-color="white"></stop>
<stop offset="100%" stop-color="black"></stop>
<animate
attributeName="r"
values="0.01; 1"
dur="3s"
begin="0s"
repeatCount="1"
fill="freeze" />
</radialGradient>
<pattern
id="dotted-pattern"
viewbox="0,0,100,100"
height="3.125%"
width="3.125%">
<circle cx="50" cy="50" fill="#10446D" r="12"/>
</pattern>
<mask id="circle-mask" maskContentUnits="userSpaceOnUse" maskUnits="userSpaceOnUse">
<circle id="kk" cx="50" cy="50" r="38.48" width="100" height="100" fill="url(#rg)">
</circle>
</mask>
</defs>
<rect
width="74"
height="74"
y="13"
x="13"
mask="url(#circle-mask)"
fill="url(#dotted-pattern)"></rect>
</svg>
SECOND Solution
You may fill the mask circle with white and animate the radius like so:
<svg viewbox="0 0 100 100">
<defs>
<pattern
id="dotted-pattern"
viewbox="0,0,100,100"
height="3.125%"
width="3.125%">
<circle cx="50" cy="50" fill="#10446D" r="12"/>
</pattern>
<mask id="circle-mask" maskContentUnits="userSpaceOnUse" maskUnits="userSpaceOnUse">
<circle id="kk" cx="50" cy="50" r="38.48" width="100" height="100" fill="white">
<animate
attributeName="r"
values="0.01; 38.48"
dur="3s"
begin="0s"
repeatCount="1"
fill="freeze" />
</circle>
</mask>
</defs>
<rect
width="74"
height="74"
y="13"
x="13"
mask="url(#circle-mask)"
fill="url(#dotted-pattern)"></rect>
</svg>

SVG Animation rotates in wrong place

I'm quite new to SVG animations and I am struggleing a bit with it.
I have written the below code to rotate an image around a center point. However, it is cutting off the top and left of the immage.
<svg width="350" height="350">
<g transform="translate(175, 175)">
<svg>
<g>
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0" to="360" begin="0" dur="500ms" repeatCount="1"></animateTransform>
<circle cx="0" cy="0" r="140" stroke="#70AD47" stroke-width="5" fill="#E2F0D6"></circle>
<text x="0" y="0" text-anchor="middle" dy="10" class="bubbleTitle" fill="#70AD47">Top</text>
<circle cx="0" cy="-120" r="50" stroke="#70AD47" stroke-width="3" fill="#E2F0D6"></circle>
<text x="0" y="-120" text-anchor="middle" dy="0">
<tspan font-size="14" class="bubbleText" x="0" dy="-1.5em">Sent</tspan>
<tspan font-size="40" class="bubbleText" x="0" dy="1.0em">#</tspan>
</text>
</g>
</svg>
</g>
</svg>
Any help with this would be hugely apreciated.
Thank you
The viewBox attribute is missing. If you set it properly the inner translation is no longer necessary.
Also remove the nested SVG element
<svg width="350" height="350" viewBox="-140 -175 280 350" xmlns="http://www.w3.org/2000/svg">
<animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0" to="360" begin="0" dur="500ms" repeatCount="1"></animateTransform>
<circle cx="0" cy="0" r="140" stroke="#70AD47" stroke-width="5" fill="#E2F0D6"></circle>
<text x="0" y="0" text-anchor="middle" dy="10" class="bubbleTitle" fill="#70AD47">Top</text>
<circle cx="0" cy="-120" r="50" stroke="#70AD47" stroke-width="3" fill="#E2F0D6"></circle>
<text x="0" y="-120" text-anchor="middle" dy="0">
<tspan font-size="14" class="bubbleText" x="0" dy="-1.5em">Sent</tspan>
<tspan font-size="40" class="bubbleText" x="0" dy="1.0em">#</tspan>
</text>
</svg>

SVG, why can :hover change the stroke-width but not the stroke-color?

Why, in this SVG, can I change the stroke-width on hover, but not the stroke-color?
The problem is clearly presented in the snippet below.
The stroke-width:5; is seeing applied to all elements in the <g id="HOVERME_LEGEND_ABC">, while the stroke:blue; is seemingly just not applied to any.
MWE SNIPPET
#LEGEND_ABC{
cursor:pointer;
}
#LEFTTICKBOX_ABC{
stroke:black;
}
#COLOUREDBOX_ABC{
fill:yellow;
stroke:black;
}
#HOVERME_LEGEND_ABC:hover{
fill:#0000EE;
stroke-width:5;
stroke:blue;
}
<svg id="SVG"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="500"
height="70"
viewBox="-15 -45 500 70">
<g id="LEGEND_ABC">
<g id="HOVERME_LEGEND_ABC">
<rect id="LEFTTICKBOX_ABC"
x="0"
y="0"
width="15"
height="15">
</rect>
<use id="COLOUREDBOX_ABC"
x="30"
y="-5"
xlink:href="#LEGENDBOX">
</use>
<text id="TEXT_ABC"
x="65"
y="12.5">
Color me (why are the rectangles not being stroked blue?)
</text>
</g>
</g>
<defs id="DEFINITIONS">
<rect id="RECTANGLE_YELLOW"
width="42.5"
height="95">
</rect>
<rect id="LEGENDBOX"
x="0"
y="0"
width="25"
height="25">
</rect>
</defs>
</svg>
What I would like, is the whole contents of <g id="HOVERME_LEGEND_ABC"> being stroked blue on hovering over the group, regardless of what stroke-colors the individual objects have before hovering over the group.
Be more spesific... #HOVERME_LEGEND_ABC:hover #COLOUREDBOX_ABC
#LEGEND_ABC{
cursor:pointer;
}
#LEFTTICKBOX_ABC{
stroke:black;
}
#COLOUREDBOX_ABC{
fill:yellow;
stroke:black;
}
#HOVERME_LEGEND_ABC:hover{
fill:#0000EE;
stroke-width:5;
stroke:blue;
}
#HOVERME_LEGEND_ABC:hover #COLOUREDBOX_ABC{
fill:#0000EE;
stroke-width:5;
stroke:blue;
}
#HOVERME_LEGEND_ABC:hover #LEFTTICKBOX_ABC{
fill:#0000EE;
stroke-width:5;
stroke:blue;
}
<svg id="SVG"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="500"
height="70"
viewBox="-15 -45 500 70">
<g id="LEGEND_ABC">
<g id="HOVERME_LEGEND_ABC">
<rect id="LEFTTICKBOX_ABC"
x="0"
y="0"
width="15"
height="15">
</rect>
<use id="COLOUREDBOX_ABC"
x="30"
y="-5"
xlink:href="#LEGENDBOX">
</use>
<text id="TEXT_ABC"
x="65"
y="12.5">
Color me (why are the rectangles not being stroked blue?)
</text>
</g>
</g>
<defs id="DEFINITIONS">
<rect id="RECTANGLE_YELLOW"
width="42.5"
height="95">
</rect>
<rect id="LEGENDBOX"
x="0"
y="0"
width="25"
height="25">
</rect>
</defs>
</svg>

Whole figure mouseover effect

When I mouseover on grey rectangle I'm scale him
<defs>
<g id="rectangl">
<rect x="-0.5" y="-0.5" width="1" height="1" fill="grey" stroke-width="0.0" />
<animateTransform attributeName="transform" attributeType="XML"
type="scale" from="1" to="1.15" repeatCount="1" begin="mouseover" dur = "0.2s"
fill="freeze"/>
</g>
I'm try to add some figures like this:
<defs>
<g id="rectangl">
<rect x="-0.5" y="-0.5" width="1" height="1" fill="grey" stroke-width="0.0" />
**<line x1="-0.5" y1="-0.5" x2="-0.5" y2="0.5" stroke-width="0.05" stroke-linecap="round"/>
<circle cx="0.5" cy="0.0" r="0.05" stroke-width="0" /><!-- dot -->
<circle cx="-0.5" cy="0.0" r="0.05" fill="white" stroke-width="0.01" />**
<animateTransform attributeName="transform" attributeType="XML"
type="scale" from="1" to="1.15" repeatCount="1" begin="mouseover" dur = "0.2s"
fill="freeze"/>
</g>
After that mouse over on any of this figures - line, circle, rect - startanimation again while i'm staying into grey rectangle.
I need to scale up(+15%) while i'm mouse over on whole figure (id="rectangl") and scale down(-15%) only when I'm mouse out from whole figure.
My similar theme SVG Carefully scale hover-kind effect using animateTransform
Thank you for understanding
Text to open in html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<svg version="1.1" xmlns:x="&ns_extend;" xmlns:i="&ns_ai;" xmlns:graph="&ns_graphs;"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:a="http://ns.adobe.com/adobesvgviewerextensions/3.0/"
x="0px" y="0px" width="800" height="600" viewBox="-400 -300 800 600" xml:space="preserve" font-family="arial" font-size="14">
<defs>
<g id="dscn.n" cursor="pointer">
<g id="rectangl">
<rect x="-0.5" y="-0.5" width="1" height="1" fill="grey" stroke-width="0.0" />
<line x1="-0.5" y1="-0.5" x2="-0.5" y2="0.5" stroke-width="0.05" stroke-linecap="round"/><!-- left vertical -->
<circle cx="0.5" cy="0.0" r="0.05" stroke-width="0" /><!-- dot -->
<circle cx="-0.5" cy="0.0" r="0.05" fill="white" stroke-width="0.01" />
<line x1="0.5" y1="0" x2="-0.15" y2="-0.5" stroke-width="0.05" stroke-linecap="round" /><!-- off -->
<animateTransform attributeName="transform" attributeType="XML"
type="scale" from="1" to="1.15" repeatCount="1" begin="mouseover" dur = "0.2s"
fill="freeze"/>
</g>
</g>
</defs>
<g transform="translate(-200,-200)" >
<title>dscn.n</title>
<g transform="scale(100,100)" fill="green" stroke="green" stroke-width="0.05" >
<use xlink:href="#dscn.n" />
</g>
</g>
</svg>
</body>
Add pointer-events="none" to the line and circle elements.

Resources