Pergunta

I want to display some data about soil moisture on a webpage. To implement this i displayed the data using d3.js. But how is it possible to display the ° character?

                    var text2 = svgContainer.selectAll("text2")
                        .data(data[0].Temperatur)
                        .enter()
                        .append("text");

                    var text2Labels = text2
                        .attr("x", "75%")
                        .attr("y", 475)
                        .attr("font-family", "Open Sans, sans-serif")
                        .attr("font-size", 70)
                        .attr("fill", "green")
                        .text(data[0].Temperatur + " alert(unescape("%B0C%0A"))");
Foi útil?

Solução

.text(data[0].Temperatur + " \u00B0");
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top