Skip to content

Commit

Permalink
remove amcharts libs
Browse files Browse the repository at this point in the history
  • Loading branch information
kowal committed Sep 19, 2023
1 parent 8853c6b commit 742bd7a
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 266 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Intro

* See full version of this project on https://rubychangelog.com/
* This page was last updated on 2023-09-09 via `rake md` task
* This page was last updated on 2023-09-19 via `rake md` task

## Ruby changelog

Expand Down
3 changes: 3 additions & 0 deletions data/ruby_cve.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"3.3.0.preview2": [

],
"3.3.0.preview1": [

],
Expand Down
48 changes: 0 additions & 48 deletions docs/docs/javascripts/charts-timeline.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/docs/versions-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,4 @@

----

(Last updated on 2023-09-09 15:03:44 +0200)
(Last updated on 2023-09-19 22:27:42 +0200)
2 changes: 1 addition & 1 deletion docs/docs/versions-latest.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,4 @@ This will be reversed again in Ruby 3.0.0</code>

----

(Last updated on 2023-09-09 15:03:44 +0200)
(Last updated on 2023-09-19 22:27:42 +0200)
7 changes: 2 additions & 5 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,12 @@ extra:
link: https://twitter.com/kowal

extra_javascript:
- https://www.amcharts.com/lib/4/core.js
- https://www.amcharts.com/lib/4/charts.js
- https://www.amcharts.com/lib/4/themes/dark.js
- https://www.amcharts.com/lib/4/themes/animated.js
- javascripts/charts-timeline.js
- https://cdn.jsdelivr.net/npm/evil-icons@1.9.0/assets/evil-icons.min.js
- https://code.jquery.com/jquery-3.5.1.min.js
- https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js
- https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js
- https://www.gstatic.com/charts/loader.js
- javascripts/charts-timeline.js

extra_css:
- https://cdn.jsdelivr.net/npm/evil-icons@1.9.0/assets/evil-icons.min.css
Expand Down
66 changes: 1 addition & 65 deletions index.html

Large diffs are not rendered by default.

64 changes: 0 additions & 64 deletions lib/templates/docs/charts/timeline.js.erb
Original file line number Diff line number Diff line change
@@ -1,66 +1,2 @@
window.onload = function () {
// Chart Themes begin
am4core.useTheme(am4themes_dark);
am4core.useTheme(am4themes_animated);
// Chart Themes end

var chart = am4core.create("chartdiv", am4charts.XYChart);
chart.hiddenState.properties.opacity = 0; // this creates initial fade-in

chart.paddingRight = 30;
chart.dateFormatter.inputDateFormat = "yyyy-MM-dd HH:mm";

var colorSet = new am4core.ColorSet();
colorSet.saturation = 0.2;

chart.data = <%= ruby_versions.map { |rb|
[*rb['minors']].map { |minor|
color = minor['version'].split.last.split('.').map { |n| n.to_i + 1 }.reduce(:*) % 255
{
"category": "Ruby #{rb['version']}",
"task": minor['version'],
"start": minor['release_date'],
"end": (minor['end_date'] != "" ? minor['end_date'] : Date.today.to_s),
"color": "rgb(255, #{color}, 0)",
"info": [
rb['state'],
rb['implementations'],
rb['changes']
].join("\n")
}
}
}.flatten.to_json %>

chart.dateFormatter.dateFormat = "yyyy-MM-dd";
chart.dateFormatter.inputDateFormat = "yyyy-MM-dd";

var categoryAxis = chart.yAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.inversed = true;

var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.minGridDistance = 70;
dateAxis.baseInterval = { count: 1, timeUnit: "day" };
// dateAxis.max = new Date(2018, 0, 1, 24, 0, 0, 0).getTime();
//dateAxis.strictMinMax = true;
dateAxis.renderer.tooltipLocation = 0;

var series1 = chart.series.push(new am4charts.ColumnSeries());
series1.columns.template.height = am4core.percent(70);
series1.columns.template.tooltipText = `
[bold]Ruby {task}
{openDateX}[/] - {dateX}[/]
`;

series1.dataFields.openDateX = "start";
series1.dataFields.dateX = "end";
series1.dataFields.categoryY = "category";
series1.columns.template.propertyFields.fill = "color"; // get color from data
series1.columns.template.propertyFields.stroke = "color";
series1.columns.template.strokeOpacity = 1;
var bullet1 = series1.bullets.push(new am4charts.LabelBullet());
bullet1.label.text = "{task}";

chart.scrollbarX = new am4core.Scrollbar();
}
81 changes: 0 additions & 81 deletions lib/templates/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,79 +14,6 @@
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
<script src="https://www.amcharts.com/lib/4/core.js"></script>
<script src="https://www.amcharts.com/lib/4/charts.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/dark.js"></script>
<script src="https://www.amcharts.com/lib/4/themes/animated.js"></script>
<script type="text/javascript">
window.onload = function () {
// Chart Themes begin
am4core.useTheme(am4themes_dark);
am4core.useTheme(am4themes_animated);
// Chart Themes end

var chart = am4core.create("chartdiv", am4charts.XYChart);
chart.hiddenState.properties.opacity = 0; // this creates initial fade-in

chart.paddingRight = 30;
chart.dateFormatter.inputDateFormat = "yyyy-MM-dd HH:mm";

var colorSet = new am4core.ColorSet();
colorSet.saturation = 0.2;

chart.data = <%= ruby_versions.map { |rb|
[*rb['minors']].map { |minor|
color = minor['version'].split.last.split('.').map { |n| n.to_i + 1 }.reduce(:*) % 255
end_date = minor['end_date'] != "" ? minor['end_date'] : (rb['eol'] ? rb['eol'] : Date.today.to_s)
{
"category": "Ruby #{rb['version']}",
"task": minor['version'],
"start": minor['release_date'],
"end": end_date,
"color": "rgb(255, #{color}, 0)",
"info": [
rb['state'],
rb['implementations'],
rb['changes']
].join("\n")
}
}
}.flatten.to_json %>

chart.dateFormatter.dateFormat = "yyyy-MM-dd";
chart.dateFormatter.inputDateFormat = "yyyy-MM-dd";

var categoryAxis = chart.yAxes.push(new am4charts.CategoryAxis());
categoryAxis.dataFields.category = "category";
categoryAxis.renderer.grid.template.location = 0;
categoryAxis.renderer.inversed = true;

var dateAxis = chart.xAxes.push(new am4charts.DateAxis());
dateAxis.renderer.minGridDistance = 70;
dateAxis.baseInterval = { count: 1, timeUnit: "day" };
// dateAxis.max = new Date(2018, 0, 1, 24, 0, 0, 0).getTime();
//dateAxis.strictMinMax = true;
dateAxis.renderer.tooltipLocation = 0;

var series1 = chart.series.push(new am4charts.ColumnSeries());
series1.columns.template.height = am4core.percent(70);
series1.columns.template.tooltipText = `
[bold]Ruby {task}
{openDateX}[/] - {dateX}[/]
`;

series1.dataFields.openDateX = "start";
series1.dataFields.dateX = "end";
series1.dataFields.categoryY = "category";
series1.columns.template.propertyFields.fill = "color"; // get color from data
series1.columns.template.propertyFields.stroke = "color";
series1.columns.template.strokeOpacity = 1;
var bullet1 = series1.bullets.push(new am4charts.LabelBullet());
bullet1.label.text = "{task}";

chart.scrollbarX = new am4core.Scrollbar();
}
</script>
</head>

<body class="text-center" data-gr-c-s-loaded="true" style="">
Expand All @@ -98,14 +25,6 @@
</header>

<main role="main" class="inner cover">
</br>
<a class="btn btn-primary" data-toggle="collapse" href="#chart-collapse-container" role="button" aria-expanded="false" aria-controls="chart-collapse-container">Toggle Chart</a>
<div class="collapse multi-collapse" id="chart-collapse-container">
<div id="chartdiv"></div>
</div>

</br><hr>

<% ruby_versions.each do |ruby_version| -%>
<div class="card">
<h5 class="card-header">Ruby <%= ruby_version['version'] %>.x</h5>
Expand Down

0 comments on commit 742bd7a

Please sign in to comment.