ERROR Chart, no visible

UI Components for React
Post Reply
francofonceca15
Posts: 1
Joined: 27 May 2021, 14:47

27 May 2021, 14:52

Buenos dias comunidad, estoy teniendo un problema que no puedo visualizar mi grafico, probé realizando npm i chart --save y no funcionó, mi codigo es el siguiente

Code: Select all

import React, { Component } from 'react'
import Card from 'react-bootstrap/esm/Card'
import Col from 'react-bootstrap/esm/Col'
import Row from 'react-bootstrap/esm/Row'
import MenuBarApp from './MenuBarApp'
import { Chart } from 'primereact/chart';

const data = {
    labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'],
    datasets: [
        {
            label: 'First Dataset',
            data: [65, 59, 80, 81, 56, 55, 40],
            fill: false,
            borderColor: '#4bc0c0'
        },
        {
            label: 'Second Dataset',
            data: [28, 48, 40, 19, 86, 27, 90],
            fill: false,
            borderColor: '#565656'
        }
    ]
}

export default class Reportes extends Component { 
    render(){
        return(
                <Row className="m-1">
                    <Col lg = "12">
                        <Card className="m-2 p-2">
                            <h5>Transacciones</h5>
                        </Card>
                    </Col>
                    <Col lg = "6" md = "6" sm = "12">
                        <Card className="m-2">
                            <h5 className="text-left m-2"> Por Cola</h5>
                            <Chart width="300" height="300" type="line" data={data} />
                        </Card>
                    </Col>
                </Row>
        )
    }
}

mert.sincan
Posts: 4741
Joined: 29 Jun 2013, 12:38

16 Jun 2021, 12:42

Hi,

Please try the latest PrimeReact version. I made some changes for the new Chart.js version.

Best Regards,

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests