{"id":30901883,"url":"https://github.com/mumarshahbaz/svg-plotter-deprecated","last_synced_at":"2025-09-09T07:08:54.597Z","repository":{"id":304152465,"uuid":"1017838285","full_name":"MUmarShahbaz/SVG-Plotter-deprecated","owner":"MUmarShahbaz","description":"Creates an SVG of a line graph using inputs. Without dependencies and simple Vanilla JS.","archived":false,"fork":false,"pushed_at":"2025-08-04T17:14:12.000Z","size":410,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-04T20:41:23.797Z","etag":null,"topics":["data-visualization","dom-manipulation","graph","javascript","svg","typescript","vanilla-javascript"],"latest_commit_sha":null,"homepage":"https://cdn.jsdelivr.net/gh/MUmarShahbaz/SVG-Plotter@dist/svg_plotter.min.js","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MUmarShahbaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-11T07:15:03.000Z","updated_at":"2025-08-04T17:14:16.000Z","dependencies_parsed_at":"2025-07-15T03:28:15.015Z","dependency_job_id":null,"html_url":"https://github.com/MUmarShahbaz/SVG-Plotter-deprecated","commit_stats":null,"previous_names":["mumarshahbaz/svg-plotter","mumarshahbaz/svg-plotter-deprecated"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MUmarShahbaz/SVG-Plotter-deprecated","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MUmarShahbaz%2FSVG-Plotter-deprecated","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MUmarShahbaz%2FSVG-Plotter-deprecated/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MUmarShahbaz%2FSVG-Plotter-deprecated/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MUmarShahbaz%2FSVG-Plotter-deprecated/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MUmarShahbaz","download_url":"https://codeload.github.com/MUmarShahbaz/SVG-Plotter-deprecated/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MUmarShahbaz%2FSVG-Plotter-deprecated/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274260706,"owners_count":25251940,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-visualization","dom-manipulation","graph","javascript","svg","typescript","vanilla-javascript"],"created_at":"2025-09-09T07:08:50.413Z","updated_at":"2025-09-09T07:08:54.588Z","avatar_url":"https://github.com/MUmarShahbaz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SVG Plotter\n\nA lightweight, TypeScript-based library for generating dynamic SVG charts and plots with customizable styling and data visualization capabilities.\n\n## Features\n\n- **Pure SVG Generation**: Creates scalable vector graphics without external dependencies\n- **TypeScript Support**: Fully typed interfaces for better development experience\n- **Multiple Chart Types**: Support for line charts with optional fill areas and data points\n- **Flexible Scaling**: Linear and logarithmic (base 2/10) y-axis scaling\n- **Time Series Support**: Built-in time formatting for time-based data\n- **Customizable Styling**: Full control over colors, dimensions, grid lines, and visual elements\n- **Dynamic Updates**: Real-time data and grid updates without recreating the entire chart\n- **Responsive Design**: Configurable dimensions and margins for different layouts\n\n## See Demo - [HERE](https://mumarshahbaz.github.io/SVG-Plotter-deprecated/demo.html)\n\n## Installation\n\nInclude the minified JavaScript file directly from jsDelivr CDN:\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/MUmarShahbaz/SVG-Plotter-deprecated@dist/svg_plotter.min.js\"\u003e\u003c/script\u003e\n```\n\nOr via ES6 import in your JavaScript/TypeScript project:\n\n```javascript\nimport { SVG_GENERATOR } from 'https://cdn.jsdelivr.net/gh/MUmarShahbaz/SVG-Plotter-deprecated@dist/svg_plotter.min.js';\n```\n\n## Usage\n\n### Basic Example\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\n    \u003ctitle\u003eSVG Plotter Example\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n    \u003cdiv id=\"chart-container\"\u003e\u003c/div\u003e\n\n    \u003cscript src=\"https://cdn.jsdelivr.net/gh/MUmarShahbaz/SVG-Plotter-deprecated@dist/svg_plotter.min.js\"\u003e\u003c/script\u003e\n    \u003cscript\u003e\n        // Define your data\n        const data = {\n            title: \"Sample Chart\",\n            grid: {\n                x: {\n                    title: \"Time\",\n                    type: \"linear\",\n                    ticks: {\n                        raw: [0, 1, 2, 3, 4, 5],\n                        formatted: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\"],\n                        min: 0,\n                        max: 5,\n                        range: 5\n                    },\n                    time_format: null\n                },\n                y: {\n                    title: \"Value\",\n                    type: \"linear\",\n                    ticks: {\n                        min: 0,\n                        max: 100,\n                        range: 100\n                    },\n                    base: null\n                }\n            },\n            series: [\n                {\n                    label: \"Dataset 1\",\n                    color: \"#3498db\",\n                    data: [10, 25, 45, 30, 60, 80]\n                }\n            ]\n        };\n\n        // Configure the chart appearance\n        const config = {\n            bg: \"#ffffff\",\n            dimensions: {\n                width: { image: 800, plot: 600 },\n                height: { image: 600, plot: 400 },\n                margins: { left: 80, right: 50, top: 50, bottom: 80 }\n            },\n            grid: {\n                gaps: {\n                    x: { gap_by: \"val\", val: 1 },\n                    y: { gap_by: \"val\", val: 20 }\n                },\n                lines: {\n                    axes: { color: \"#2c3e50\", width: 2 },\n                    main: { color: \"#bdc3c7\", width: 1 },\n                    font: { color: \"#2c3e50\", size: 12 }\n                }\n            },\n            series: {\n                width: 2,\n                alpha: 1,\n                point: { radius: 4, alpha: 1 },\n                fill: { alpha: 0.3 }\n            }\n        };\n\n        // Create the chart\n        const chart = SVG_GENERATOR(config, data, \"my-chart\");\n\n        // Initialize and append to DOM\n        const container = document.getElementById('chart-container');\n        const svgElement = chart.init(container);\n        chart.updateGrid();\n        chart.updateData();\n    \u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n### ES6 Module Example\n\n```javascript\nimport { SVG_GENERATOR } from 'https://cdn.jsdelivr.net/gh/MUmarShahbaz/SVG-Plotter-deprecated@dist/svg_plotter.min.js';\n\n// Define your data\nconst data: DATA = {\n  title: \"Sample Chart\",\n  grid: {\n    x: {\n      title: \"Time\",\n      type: \"linear\",\n      ticks: {\n        raw: [0, 1, 2, 3, 4, 5],\n        formatted: [\"0\", \"1\", \"2\", \"3\", \"4\", \"5\"],\n        min: 0,\n        max: 5,\n        range: 5\n      },\n      time_format: null\n    },\n    y: {\n      title: \"Value\",\n      type: \"linear\",\n      ticks: {\n        min: 0,\n        max: 100,\n        range: 100\n      },\n      base: null\n    }\n  },\n  series: [\n    {\n      label: \"Dataset 1\",\n      color: \"#3498db\",\n      data: [10, 25, 45, 30, 60, 80]\n    }\n  ]\n};\n\n// Configure the chart appearance\nconst config: SVG_CONFIG = {\n  bg: \"#ffffff\",\n  dimensions: {\n    width: { image: 800, plot: 600 },\n    height: { image: 600, plot: 400 },\n    margins: { left: 80, right: 50, top: 50, bottom: 80 }\n  },\n  grid: {\n    gaps: {\n      x: { gap_by: \"val\", val: 1 },\n      y: { gap_by: \"val\", val: 20 }\n    },\n    lines: {\n      axes: { color: \"#2c3e50\", width: 2 },\n      main: { color: \"#bdc3c7\", width: 1 },\n      font: { color: \"#2c3e50\", size: 12 }\n    }\n  },\n  series: {\n    width: 2,\n    alpha: 1,\n    point: { radius: 4, alpha: 1 },\n    fill: { alpha: 0.3 }\n  }\n};\n\n// Create the chart\nconst chart = SVG_GENERATOR(config, data, \"my-chart\");\n\n// Initialize and append to DOM\nconst svgElement = chart.init(document.body);\nchart.updateGrid();\nchart.updateData();\n```\n\n### Time Series Example\n\n```javascript\nconst timeData = {\n    title: \"Performance Over Time\",\n    grid: {\n        x: {\n            title: \"Time\",\n            type: \"time\",\n            ticks: {\n                raw: [0, 60000, 120000, 180000], // milliseconds\n                formatted: [\"0\", \"1m\", \"2m\", \"3m\"],\n                min: 0,\n                max: 180000,\n                range: 180000\n            },\n            time_format: \"m:s\"\n        },\n        // ... rest of configuration\n    }\n    // ... rest of data\n};\n```\n\n### Logarithmic Scale Example\n\n```javascript\nconst logData = {\n    // ... other properties\n    grid: {\n        // ... x configuration\n        y: {\n            title: \"Log Scale\",\n            type: \"log\",\n            ticks: {\n                min: 1,\n                max: 1000,\n                range: 999\n            },\n            base: 10\n        }\n    }\n    // ... rest of data\n};\n```\n\n## API Reference\n\n### SVG_GENERATOR(config, data, id)\n\nCreates a new SVG chart object.\n\n**Parameters:**\n- `config` (Object): Chart configuration object\n- `data` (Object): Chart data object  \n- `id` (string): Unique identifier for the SVG element\n\n**Returns:** Chart object with the following methods:\n\n#### Methods\n\n- **`init(parent?: HTMLElement)`**: Initialize the SVG element and optionally append to parent\n- **`updateGrid(append?: boolean)`**: Update or redraw the grid\n- **`updateData(append?: boolean, new_data?: Object, refresh_grid?: boolean)`**: Update chart data\n\n### Data Types\n\n#### Time Formats\n- `\"ms\"`: Milliseconds (e.g., \"1500ms\")\n- `\"s.ms\"`: Seconds with milliseconds (e.g., \"1.500s\") \n- `\"m:s\"`: Minutes and seconds (e.g., \"1:30\")\n- `\"h:m:s\"`: Hours, minutes, seconds (e.g., \"1:30:45\")\n- `\"d-h:m\"`: Days, hours, minutes (e.g., \"2-14:30\")\n\n#### Grid Gap Modes\n- `\"val\"`: Gap by data value\n- `\"px\"`: Gap by pixel distance\n\n#### Scale Types\n- `\"linear\"`: Linear scaling\n- `\"log\"`: Logarithmic scaling (base 2 or 10)\n- `\"time\"`: Time-based x-axis\n\n## Configuration Options\n\n### Dimensions\n```javascript\ndimensions: {\n  width: { image: number, plot: number },\n  height: { image: number, plot: number },\n  margins: { left: number, right: number, top: number, bottom: number }\n}\n```\n\n### Grid Configuration\n```javascript\ngrid: {\n  gaps: {\n    x: { gap_by: \"val\" | \"px\", val: number },\n    y: { gap_by: \"val\" | \"px\", val: number } | null\n  },\n  lines: {\n    axes: { color: string, width: number },\n    main: { color: string, width: number },\n    font: { color: string, size: number }\n  }\n}\n```\n\n### Series Styling\n```javascript\nseries: {\n  width: number,                              // Line width\n  alpha: number,                              // Line opacity (0-1)\n  point: { radius: number, alpha: number } | null,  // Data points\n  fill: { alpha: number } | null              // Fill area under line\n}\n```\n\n## Browser Support\n\nThis library uses standard DOM APIs and SVG elements, making it compatible with all modern browsers that support:\n- SVG 1.1\n- ES2017 features\n- DOM manipulation\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the terms found in the [LICENSE.md](LICENSE.md) file.\n\n## Examples\n\nCheck out the `examples/` directory for more detailed usage examples and demos.\n\n---\n\nBuilt with TypeScript and ❤️ for data visualization.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmumarshahbaz%2Fsvg-plotter-deprecated","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmumarshahbaz%2Fsvg-plotter-deprecated","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmumarshahbaz%2Fsvg-plotter-deprecated/lists"}