Skip to content

📋 Angular app to display crypto currency data using chart.js

Notifications You must be signed in to change notification settings

AndrewJBateman/angular-charts-data

Repository files navigation

⚡ Angular Charts Data

  • Angular app using Chart.js to display free Coinranking API data
  • Tutorial code from The Code Angle with additional chart, pan/zoom and some other code changes
  • Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

📄 Table of contents

📚 General info

  • To get temporary access to the CORS proxy url it is necessary to click a request button at https://cors-anywhere.herokuapp.com/corsdemo
  • Chart types: ArcElement, LineElement, BarElement, PointElement, BarController, BubbleController, DoughnutController, LineController, PieController, PolarAreaController, RadarController, ScatterController, CategoryScale, LinearScale, LogarithmicScale, RadialLinearScale, TimeScale, TimeSeriesScale, Decimation, Filler, Legend, Title, Tooltip, SubTitle
  • toPromise used; a constructor that resolves to ZoneAwarePromise() from zone.js at run time in the browser.

📷 Screenshots

Example screenshot

📶 Technologies

💾 Setup

  • Run npm i to install dependencies
  • Create an account & get a Developers API key from Coinranking
  • Add API key to services\authService
  • Enables temporary CORS issue workaround via https://cors-anywhere.herokuapp.com/corsdemo
  • Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
  • Run 'ng build' to create a build file

💻 Code Examples

  • extract from app.component.ts to create chart2 data
this.chart2 = new Chart('canvas2', {
  type: 'bar',
  data: {
    labels: this.coinName,
    datasets: [
      {
        data: this.coinPrice,
        borderColor: '#0d47a1',
        label: 'Bar Chart: Crypto Prices',
        backgroundColor: 'rgba(93, 175, 89, 0.1)',
        borderWidth: 1,
      },
    ],
  },
});

🆒 Features

  • Charts.js has other types of charts and lots of options that can be configured.

📋 Status & To-Do List

  • Status: Working
  • To-Do: Could add data types to replace 'any'

👏 Inspiration

📁 License

  • N/A

✉️ Contact