Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
266 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 Answer

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
            }
          }]
       },

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...