1
私はAngular 2で異なるチャートライブラリをテストしていますので、D3、Flot、uvChartなどの異なるチャートライブラリの上にservalディレクティブを書きました C3チャートを作成した後、私はあなたがライン間の色が黒色に反転して見ることができる、と私はそれを置くと、ツールチップの色はここで白色にAngular2 C3チャートの色が変わっています
を逆転してしまう
にC3 this is the imageから変なグラフを得た私のコードの一部です
c3.directive.ts:
import { Directive, ElementRef, Renderer, Input } from '@angular/core';
declare var jQuery: any;
declare var c3: any;
@Directive({
selector: '[c3-chart]'
})
export class C3ChartDirective {
$el: any;
@Input() data: any;
@Input() options: string;
constructor(el: ElementRef, renderer: Renderer) {
this.$el = jQuery(el.nativeElement);
}
ngOnInit(): void {
this.render();
}
// c3 chart render function
render(): void {
let elementID = '#' + this.$el.attr('id');
console.log(elementID);
let chart = c3.generate({
bindto: elementID,
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
]
}
});
}
}
c3.module.ts:
import { NgModule } from '@angular/core';
import { C3ChartDirective } from './index';
@NgModule({
declarations: [
C3ChartDirective
],
exports: [
C3ChartDirective
]
})
export class C3Module{
}
いくつかのポイントを受け取るために緑の疑問符で正しい答えとしてあなた自身の答えを選択してください:) – jhhoff02
あなたの助言のためにそれを得ました –