Z
Z
zelsky2016-11-10 22:07:52
JavaScript
zelsky, 2016-11-10 22:07:52

How to make an example of a line with a title in d3.js?

I make a graph using d3 js, there is a style for the line like this:

.lineone path.line {
    fill: none;
    stroke: red;
    stroke-width: 2;
    stroke-dasharray: 10, 5;
}

circle.lineone {
    fill: red;
    stroke: red;

}

And the code for adding a label for the line at the bottom of the chart.
svg.append("g")
        .append('text')
        .attr("class", "chart-label-actual")
        .text(' Label for lineone')
        .attr('x', 1)
        .attr('y', height - 50)

The question is how to draw a straight line as an example on the right side of the label? A straight line with styles for .lineone ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zelsky, 2016-11-10
@zelsky

svg.append("g")
        .append("line")
        .attr("x1", width - 100)
        .attr("y1", height - 55)
        .attr("x2", width - 30)
        .attr("y2", height - 55)
        .attr("class", "lineone");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question