CHROMATIC-SYSTEM v1.03_LINE_CHART_WITH_INPUT_VALUES_DISPLAY_ENGINE

INFORMATION & CODE

Line Chart with Input Values Display

What the Code Does

This code provides a web-based tool for plotting 2D coordinate data directly onto an HTML5 canvas. It consists of an HTML structure containing an interactive data input text area and a preview button, a CSS stylesheet that styles the user interface elements, and JavaScript logic that processes the input coordinates and dynamically renders a graphical chart.

How the Code Works

The application works by reading comma-separated X and Y coordinate pairs from the text area whenever the user clicks the "Preview" button. The JavaScript parses these values into respective arrays, calculates the minimum and maximum boundaries of the dataset to determine proper scaling, and translates the data points to fit a customized Cartesian coordinate system drawn on the canvas. It then visually plots the data by rendering lime-colored square markers for each coordinate, connecting them with line segments, and automatically generating proportional axis labels and grid ticks.

To use the code, save the HTML, CSS, and JavaScript segments into three separate files named respectively (e.g., index.html, styles.css, and scripts.js) within the same directory. Open the index.html file in any modern web browser. You will see a table interface containing a pre-filled list of X and Y coordinates; simply modify these numbers in the text area (using the format x,y on separate lines) and click the Preview button to instantly generate and update the corresponding line and scatter plot on the canvas.

HTML

CSS

JAVASCRIPT

PREVIEW

Data (x,y):