Package Exports
- @onvo-ai/chartjs-chart-map
- @onvo-ai/chartjs-chart-map/dist/index.cjs.js
- @onvo-ai/chartjs-chart-map/dist/index.es.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@onvo-ai/chartjs-chart-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Chart.js Map Plugin
A Chart.js plugin that implements a new chart type integrating Google Maps functionality.
Installation
npm install chart.js @types/google.mapsUsage
- Import the plugin and register it with Chart.js:
import { Chart } from 'chart.js';
import './plugins/chartjs-map';- Load Google Maps API with your API key:
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY"></script>- Create a new chart with type 'map':
new Chart(canvas, {
type: 'map',
data: {
datasets: [{
data: [
{ lat: 40.7128, lng: -74.0060, label: 'New York' },
{ lat: 51.5074, lng: -0.1278, label: 'London' }
]
}]
},
options: {
responsive: true,
plugins: {
tooltip: {
enabled: true
}
},
markerStyle: {
defaultColor: '#FF0000',
defaultSize: 8,
shape: 'circle'
}
}
});Configuration Options
Data Point Properties
lat(required): Latitude coordinatelng(required): Longitude coordinatelabel(optional): Marker labelcolor(optional): Marker colorsize(optional): Marker size
Chart Options
responsive: Enable responsive modemaintainAspectRatio: Maintain aspect ratiomarkerStyle:defaultColor: Default marker colordefaultSize: Default marker sizeshape: Marker shape ('circle', 'square', 'pin')
Plugin Options
tooltip: Standard Chart.js tooltip optionslegend: Standard Chart.js legend options
Features
- Google Maps integration
- Custom markers with configurable styles
- Automatic bounds fitting
- Responsive design
- Interactive tooltips
- Legend support
- Window resize handling
TypeScript Support
Type definitions are included in the plugin. Import the types:
import { MapDataPoint, MapChartOptions } from './plugins/chartjs-map';