I'm using Angular 2.0 TypeScript and d3.js libary for creating grafic. I'm trying to apply css on asix ( most importand shape-rendering: crispEdges;
). Do you have any idea?
here is the code
var vis = d3.select("#visualisation"),
WIDTH = 1000,
HEIGHT = 500,
MARGINS = {
top: 20,
right: 20,
bottom: 20,
left: 50
},
xRange = d3.scale.linear()
.range([MARGINS.left, WIDTH - MARGINS.right])
.domain([d3.min(this.calculationResults, function(d) { return d.time;}),
d3.max(this.calculationResults, function(d) { return d.time;})]),
yRange = d3.scale.linear()
.range([HEIGHT - MARGINS.top, MARGINS.bottom])
.domain([d3.min(this.calculationResults, function(d) { return d.force; }),
d3.max(this.calculationResults, function(d) { return d.force;})]),
xAxis = d3.svg.axis()
.scale(xRange)
.ticks(10)
.tickSize(5)
.tickSubdivide(true),
yAxis = d3.svg.axis()
.scale(yRange)
.ticks(10)
.tickSize(5)
.orient("left")
.tickSubdivide(true);
vis.append("svg:g")
.attr("class", "x axis")
.attr("transform", "translate(0," + (HEIGHT - MARGINS.bottom) + ")")
.call(xAxis);
vis.append("svg:g")
.attr("class", "y axis")
.attr("transform", "translate(" + (MARGINS.left) + ",0)")
.call(yAxis);
and css code
.axis path, .axis line
{
fill: none;
stroke: #777;
shape-rendering: crispEdges;
}
.tick
{
stroke-dasharray: 1, 2;
}
please share your answer :)