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 :)
Angular 2 is a newer version of AngularJS, released in 2016. This version of the framework using TypeScript, which is an open-sourced programming language maintained by Microsoft. Angular 2 is more useful for developing mobile applications and includes higher performance speeds than AngularJS.
Angular versions v2 to v11 are no longer under support.
Angular 2 is a framework for building web or mobile applications in HTML and Javascript or Typescript. It's the right choice of framework to use for your web or mobile applications.
Angular 2.0 is the older version and Angular 8.0 is the relatively newer version that has incorporated many new features. If you wish to get skilled in Angular, Angular rooting, TypeScript, Dependency Injection, Pipes, Forms, Bootstrap, System JS, etc.
I'm not sure but this should help you,
encapsulation mode
and/or
piercing CSS combinators >>>, /deep/
and ::shadow
look here - Styles in component for D3.js do not show in angular 2
Best luck !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With