我是D3.js的新手,我设法用我在互联网上找到的东西来创建一个仪表.但我找不到任何仪表显示针头顶部的当前值.这样的事情:我想要的
显然我喜欢追随针的价值.我试图在针本身添加"text"属性,但它没有用.
这是一个codepen链接:http://codepen.io/kazu_codepen/pen/wGmGjv?edit = 1010
这是我的js代码:
// data which need to be fetched
var name = "azerty";
var value = 17;
var gaugeMaxValue = 100;
// data to calculate
var percentValue = value / gaugeMaxValue;
////////////////////////
var needleClient;
(function(){
var barWidth, chart, chartInset, degToRad, repaintGauge,
height, margin, numSections, padRad, percToDeg, percToRad,
percent, radius, sectionIndx, svg, totalPercent, width;
percent = percentValue;
numSections = 1;
sectionPerc = 1 / numSections / 2;
padRad = 0.025;
chartInset = 10;
// …Run Code Online (Sandbox Code Playgroud) 到目前为止,我已经尝试了很多不同的东西,例如:
/deep/ .mat-select:focus .mat-select-trigger .mat-select-arrow {
color: #63961C;
}
/deep/ .mat-select:focus .mat-select-trigger .mat-select-underline {
background-color: #63961C;
}
Run Code Online (Sandbox Code Playgroud)
要么 :
/deep/ .mat-select.mat-focused .mat-select-trigger .mat-select-arrow {
color: #63961C;
}
/deep/ .mat-select.mat-focused .mat-select-trigger .mat-select-underline {
background-color: #63961C;
}
Run Code Online (Sandbox Code Playgroud)
更改选择旁边的小箭头和下划线.
例如,我做到了
/deep/ .mat-input-container.mat-focused .mat-input-underline {
background-color: #63961C;
}
Run Code Online (Sandbox Code Playgroud)
对于输入的下划线,它工作正常(聚焦时变为绿色).(是/深/适用于这个项目,虽然如果我记得很清楚它现在已被弃用)
我设法"一直"改变它,但我想要的是,它只在焦点上绿色,如果没有聚焦则保持灰色.
我正在尝试在滚动时在屏幕顶部保留一个div.
我找到了几个关于它的指南和SO问题,但它对我不起作用.
我使用过这些:
这就是我到目前为止所做的事情:
零件 :
import {DOCUMENT} from '@angular/platform-browser';
@Component({
selector: 'example',
templateUrl: './example.component.html',
styleUrls: ['./example.component.css'],
})
export class ExampleComponent implements OnInit {
public fixed: boolean = false;
constructor( @Inject(DOCUMENT) private doc: Document) {}
ngOnInit(): void {
this.onWindowScroll();
}
@HostListener('window:scroll', [])
onWindowScroll() {
let number = window.pageYOffset || document.documentElement.scrollTop || window.scrollY || 0;
if (number > 100) {
this.fixed = true;
} else if (this.fixed && number < 10) {
this.fixed = false; …Run Code Online (Sandbox Code Playgroud) 我搜索了一下,发现了一个非常相似的问题,不幸的是它并不能解决我的问题。
类似的问题:这里
我正在使用 Jaspert Report 6.6.0 和 Java 1.8。
我的目标是在报告中插入图像,我无法更改太多java代码,并且图像存储为byte []。
所以,我尝试了这个:
<field name="logo" class="java.io.InputStream"/>
// ... other stuff that is displayed properly
<image scaleImage="FillFrame" onErrorType="Blank">
<reportElement style="Column header" x="0" y="-1" width="80" height="75" backcolor="#333333" uuid="80bcba32-4e50-4a3a-949c-39e7c22ddff4"/>
<imageExpression><![CDATA[new java.io.ByteArrayInputStream(org.apache.commons.codec.binary.Base64.decodeBase64($P{logo}.getBytes()))]]></imageExpression>
</image>
Run Code Online (Sandbox Code Playgroud)
有了这个Java代码:
//a big bunch of fileds that I managed to display properly
private InputStream logo;
public Constructor(some, stuff, imageAsByteArray) {
// setting lots of things that are displayed properly
this.setLogo(new ByteArrayInputStream(Base64.decodeBase64(imageAsByteArray)));
}
Run Code Online (Sandbox Code Playgroud)
但是,在 Jasper Studio 中,当我尝试保存 jrxml 文件时,出现此错误:
对于类型 InputStream ,方法 …
我正在努力解决这个错误:
NavigationError(id: 2, url: '/something/create?user=3#new', error: 错误: 无法匹配任何路由。URL 段: 'something/create')
到目前为止我已经做到了:
一些组件.ts
constructor( private router: Router ) {}
createNew() {
const navigateToNewWithUser: NavigationExtras = {
fragment: 'new',
queryParams: {'user': this.user.id}
};
this.router.navigate(['/something/create'], navigateToNewWithUser);
}
Run Code Online (Sandbox Code Playgroud)
一些.component.html
<button class="btn add-button float-right jh-create-entity" (click)="createNew()">
Run Code Online (Sandbox Code Playgroud)
一些.route.ts
{
path: 'something/create?user=:id#new',
component: SomeComponent,
resolve: {
supervision: UserPageResolver
},
data: {
authorities: ['ROLE_ADMIN'],
pageTitle: 'home.create'
},
canActivate: [UserRouteAccessService]
}
Run Code Online (Sandbox Code Playgroud)
所有其他路线都采用相同的模式并且工作得很好。我不明白,因为/something/create?user=3#new与我在route.ts中输入的内容相匹配
我正在处理使用 JHipster 生成的 Angular 6 项目。我尝试更改 URL、删除#new、放在?user=:id末尾等等,但最终总是出现相同的错误。
任何想法 ?我在这里阅读了很多有关角度路由的问题,但尚未找到我的问题的答案。
如果您需要更多代码,请询问。
angular ×3
arrays ×1
css ×1
d3.js ×1
gauge ×1
html ×1
image ×1
java ×1
javascript ×1
jhipster ×1
navigation ×1
routes ×1
sticky ×1
typescript ×1