Answer the question
In order to leave comments, you need to log in
How to implement your own JS library and provide an API?
Hey!
The test task itself looks like this:
Implement a library prototype for displaying line graphs using WEB Canvas, including:
1. Provide your API to set an array of "graphs". Each "chart" must have:
a. Parameter name;
b. Array of points (X,Y).
2. The library must support the following features:
a. Track changes in your own dimensions and provide autofit;
b. Display axes, indicating the parameters displayed on the axes;
c. Track the position of the mouse with the display of a tooltip by points;
d. Scaling the plot area.
The completed test tasks will be tested, including on large arrays of input data.
Answer the question
In order to leave comments, you need to log in
Since this is a test task, it should be considered that it is self-sufficient.
All disputes you resolve at your discretion.
Thus, we see that we need to be able to draw several graphs.
Prototyping a simple interface
MyChart.init({
charts: [
{
name: 'name',
axis: {
x: { /* параметры для оси X */ }
y: { /* параметры для оси Y */ }
},
data: [ /* массив данных (точек) для отрисовки */
{x:1,y:2},
//...
],
},
],
});
You need to write the library in such a way that other programmers can conveniently use it in their applications without delving into how its functionality is implemented.
API (application programming interface, application programming interface) (English application programming interface, API [hey-pee] [1]) - a description of the ways (a set of classes, procedures, functions, structures or constants) in which one computer program can interact with another program.
The API defines the functionality that a program (module, library) provides, while the API allows you to abstract from how exactly this functionality is implemented.
If a program (module, library) is considered as a black box, then the API is a set of “handles” that are available to the user of this box and which he can turn and pull.
should it just be a small library with a set of methods for drawing line graphs?
And what does API mean here - the external interface itself for working with the library or something more complicated
Has anyone come across this?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question