Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
271 views
in Technique[技术] by (71.8m points)

css - How to modify this graphic Angular char

I'm trying to change one graphic, I want to hide the dataset labels, but nothing I tried is working.

Graphic

The library that I'm using is library:

import { ChartDataSets, ChartOptions, ChartType } from 'chart.js';
import { Color } from 'ng2-charts/public_api';
import { BaseChartDirective,Label } from 'ng2-charts';

This is my code:

  labelsGraphic:[];
  public lineChartData: ChartDataSets[] = [{data:[], label:""}];
  public lineChartLabels:Label[];

  public lineChartColors: Color[] = [
    { // blue
      backgroundColor: '#13161a',
      borderColor: '#257bcc',
      pointBackgroundColor: 'rgba(148,159,177,1)',
      pointBorderColor: '',
      pointRadius:0,
      pointHoverBackgroundColor: '#fff',
      pointHoverBorderColor: 'rgba(148,159,177,0.8)'

    },
  ];
  public lineChartOptions: (ChartOptions & { annotation: any }) = {
    responsive: true,
    scales: {
      xAxes: [{
         gridLines: {
            display: false
         }
      }],
      yAxes: [{
         gridLines: {
            display: false
         }
      }]
   },
    annotation: {

    },
  };

  public lineChartLegend = false;
  public lineChartType: ChartType = 'line';

I tried changing gridLines to ticks but I think this object is not modifying anything.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

try put scales without using gridLines attributes for lower version

 scales: {
      xAxes: [{
         display: false
      }],
      yAxes: [{
         display: false
      }]
   },

for latest versions try to disable ticks

scales: {
          xAxes: [{
             ticks: {
                display: false
            }
          }],
          yAxes: [{
              ticks: {
                display: false
            }
          }]
       },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...