GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JavaScript-Chart-Samples/Samples/LineChart.js at master · JaytheSpazz/JavaScript-Chart-Samples

Expand file tree

/

LineChart.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
170 lines (170 loc) · 7.22 KB
/

LineChart.js

Copy path

File metadata and controls

170 lines (170 loc) · 7.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
define(["require", "exports", 'Scripts/MindFusion.Charting'], function (require, exports, m) {
"use strict";
var Charting = m.MindFusion.Charting;
var Controls = m.MindFusion.Charting.Controls;
var Collections = m.MindFusion.Charting.Collections;
var Drawing = m.MindFusion.Charting.Drawing;
var chartEl = document.getElementById('lineChart');
chartEl.width = chartEl.offsetParent.clientWidth;
chartEl.height = chartEl.offsetParent.clientHeight;
// create the chart
var lineChart = new Controls.LineChart(chartEl);
lineChart.theme.loadFrom('Resources/DefaultExt.xml');
// create line brushes
var firstBrush = new Drawing.Brush("#669acc");
var secondBrush = new Drawing.Brush("#ce0000");
var thirdBrush = new Drawing.Brush("#003466");
lineChart.legendRenderer.background = new Drawing.Brush("#e0e9e9");
lineChart.legendRenderer.borderStroke = new Drawing.Brush("#c0c0c0");
lineChart.showZoomWidgets = true;
// create sample data series
var labels = new Collections.List([
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
]);
var series1 = new Charting.Series2D(new Collections.List([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]), new Collections.List([0, 17, 22, 13, 4, 15, 26, 7, 28, 29, 10, 19]), labels);
series1.title = "Series 1";
lineChart.series.add(series1);
var series2 = new Charting.Series2D(new Collections.List([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), new Collections.List([2, 3, 7, 6, 9, 11, 13, 10, 14, 18, 21, 24]), labels);
series2.title = "Series 2";
lineChart.series.add(series2);
//lineChart.Series.Add(
// new FunctionSeries("x*Sin(x)+x+5", 12, 12)
// { Title = "Series 3" });
lineChart.xAxis.interval = 1;
lineChart.showXRangeSelector = true;
lineChart.xScrollRangeMin = -50;
lineChart.xScrollRangeMax = 50;
lineChart.showYRangeSelector = true;
lineChart.yScrollRangeMin = -50;
lineChart.yScrollRangeMax = 50;
// assign one brush per series
var style = new Charting.MixedSeriesStyle();
style.commonFills = new Collections.List([firstBrush, secondBrush, thirdBrush]);
style.commonStrokes = new Collections.List([firstBrush, secondBrush, thirdBrush]);
style.uniformStrokeThickness = 5;
lineChart.plot.seriesStyle = style;
lineChart.theme.gridColor1 = Drawing.Color.fromArgb(255, 255, 255);
lineChart.theme.gridColor2 = Drawing.Color.fromArgb(224, 233, 233);
lineChart.theme.gridLineThickness = 0;
lineChart.draw();
// handlers
var gridType = document.getElementById('gridType');
gridType.selectedIndex = lineChart.gridType;
gridType.onchange = function () {
lineChart.gridType = gridType.selectedIndex;
lineChart.draw();
};
var lineType = document.getElementById('lineType');
lineType.selectedIndex = lineChart.lineType;
lineType.onchange = function () {
lineChart.lineType = lineType.selectedIndex;
lineChart.draw();
};
var xAxisMin = document.getElementById('xAxisMin');
xAxisMin.valueAsNumber = lineChart.xAxis.effectiveMinValue;
xAxisMin.onchange = function () {
lineChart.xAxis.minValue = xAxisMin.valueAsNumber;
lineChart.draw();
};
var xAxisMax = document.getElementById('xAxisMax');
xAxisMax.valueAsNumber = lineChart.xAxis.effectiveMaxValue;
xAxisMax.onchange = function () {
lineChart.xAxis.maxValue = xAxisMax.valueAsNumber;
lineChart.draw();
};
var yAxisMin = document.getElementById('yAxisMin');
yAxisMin.valueAsNumber = lineChart.yAxis.effectiveMinValue;
yAxisMin.onchange = function () {
lineChart.yAxis.minValue = yAxisMin.valueAsNumber;
lineChart.draw();
};
var yAxisMax = document.getElementById('yAxisMax');
yAxisMax.valueAsNumber = lineChart.yAxis.effectiveMaxValue;
yAxisMax.onchange = function () {
lineChart.yAxis.maxValue = yAxisMax.valueAsNumber;
lineChart.draw();
};
var xRangeMin = document.getElementById('xRangeMin');
xRangeMin.valueAsNumber = lineChart.xScrollRangeMin;
xRangeMin.onchange = function () {
lineChart.xScrollRangeMin = xRangeMin.valueAsNumber;
lineChart.draw();
};
var xRangeMax = document.getElementById('xRangeMax');
xRangeMax.valueAsNumber = lineChart.xScrollRangeMax;
xRangeMax.onchange = function () {
lineChart.xScrollRangeMax = xRangeMax.valueAsNumber;
lineChart.draw();
};
var yRangeMin = document.getElementById('yRangeMin');
yRangeMin.valueAsNumber = lineChart.yScrollRangeMin;
yRangeMin.onchange = function () {
lineChart.yScrollRangeMin = yRangeMin.valueAsNumber;
lineChart.draw();
};
var yRangeMax = document.getElementById('yRangeMax');
yRangeMax.valueAsNumber = lineChart.yScrollRangeMax;
yRangeMax.onchange = function () {
lineChart.yScrollRangeMax = yRangeMax.valueAsNumber;
lineChart.draw();
};
var showXticks = document.getElementById('showXticks');
showXticks.checked = lineChart.showXTicks;
showXticks.onchange = function () {
lineChart.showXTicks = showXticks.checked;
lineChart.draw();
};
var showYticks = document.getElementById('showYticks');
showYticks.checked = lineChart.showYTicks;
showYticks.onchange = function () {
lineChart.showYTicks = showYticks.checked;
lineChart.draw();
};
var showXCoords = document.getElementById('showXCoords');
showXCoords.checked = lineChart.showXCoordinates;
showXCoords.onchange = function () {
lineChart.showXCoordinates = showXCoords.checked;
lineChart.draw();
};
var showYCoords = document.getElementById('showYCoords');
showYCoords.checked = lineChart.showYCoordinates;
showYCoords.onchange = function () {
lineChart.showYCoordinates = showYCoords.checked;
lineChart.draw();
};
var showXRange = document.getElementById('showXRange');
showXRange.checked = lineChart.showXRangeSelector;
showXRange.onchange = function () {
lineChart.showXRangeSelector = showXRange.checked;
lineChart.draw();
};
var showYRange = document.getElementById('showYRange');
showYRange.checked = lineChart.showYRangeSelector;
showYRange.onchange = function () {
lineChart.showYRangeSelector = showYRange.checked;
lineChart.draw();
};
var showLegend = document.getElementById('showLegend');
showLegend.checked = lineChart.showLegend;
showLegend.onchange = function () {
lineChart.showLegend = showLegend.checked;
lineChart.draw();
};
var scrollGrid = document.getElementById('scrollGrid');
scrollGrid.checked = lineChart.pinGrid;
scrollGrid.onchange = function () {
lineChart.pinGrid = scrollGrid.checked;
lineChart.draw();
};
var showDataLabels = document.getElementById('showDataLabels');
showDataLabels.checked = lineChart.showDataLabels == Charting.LabelKinds.All;
showDataLabels.onchange = function () {
if (showDataLabels.checked)
lineChart.showDataLabels = Charting.LabelKinds.All;
else
lineChart.showDataLabels = Charting.LabelKinds.None;
lineChart.draw();
};
});
//# sourceMappingURL=LineChart.js.map
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.