A chart (graph) is a 2D or 3D graphical object that presents a value or calculation result in the form of bars, columns, lines, etc. Graphs are generally used to support data during the presentation process and provide an overview or development of a previously determined calculation result, including past or future developments.
Daftar Isi
Create a new project
- Create a new project
$ rails new Chart$ cd Chart -
$ bundle install
Creation of CRUD for users
- Create CRUD for user using Scaffold function
$ rails generate scaffold Siswa nama:string kelas:string skor_uts:integer skor_uas:integer rata_rata:float - Create a new database then migrate to generate the Student table
$ rake db:create$ rake db:migrate$ rails s - Please check localhost:3000/student, to make sure our app can be opened.
- Before creating data, please add the following code in views/siswas/_form.html.erb so that the average field can be filled automatically after entering the UAS score.
-
<script> $(document).ready(function(){ $("#siswa_skor_uas").change(function(){ var_skor_uts = parseInt($("#siswa_skor_uts").val()); var_skor_uas = parseInt($("#siswa_skor_uas").val()); $("#siswa_rata_rata").val((var_skor_uts * 0.3) +( var_skor_uas * 0.7)); }); }); </script> - Create data to later implement in a chart
Implementing Charts with Canvasjs
- We will create a chart on the page, views/students/show.html.erb
- First create a file with the name “canvasjs.min.js” in the assets/javascripts folder, then copy the code in this link canvasjs.min.js
- Then edit assets/javascripts/application.js, adding the following code before “//= require_tree.”
//= require canvasjs.min //= require Chart //= require_tree . - To display the chart, edit the views/siswas/show.html.erb file and add the following code to the bottom line
<div id="grafik_siswa" style="height:400px;width:50%;"></div> <script> $(function () { var graph = { title: { text: "Grafik Nilai <%= @siswa.nama %>" }, animationEnabled: true, data: [ { type: "splineArea", dataPoints: [ { y: parseInt("<%= @siswa.skor_uts %>"), label: "UAS"}, { y: parseInt("<%= @siswa.skor_uas %>"), label: "UTS"}, { y: parseInt("<%= @siswa.rata_rata %>"), label: "Rata-rata"} ] } ] }; $("#grafik_siswa").CanvasJSChart(graph); }); </script> - The following is a display of the chart that appears on the display page
Implementing Charts with Chartjs
- We will create a chart on the page, views/students/show.html.erb using chartjs
- First, create a file with the name “Chart.js” in the assets/javascripts folder, then copy the code to this Chart.js link
- To display the graph, edit the views/siswas/show.html.erb file, and add the following code
<div id="grafik_siswa" style="height:400px;width:50%;"></div> <br><br> <div><canvas id="grafik_siswa2" style="height:500px;width:100%;"></canvas></div> <script> $(function () { var graph = { title: { text: "Grafik Nilai <%= @siswa.nama %>" }, animationEnabled: true, data: [ { type: "splineArea", dataPoints: [ { y: parseInt("<%= @siswa.skor_uts %>"), label: "UAS"}, { y: parseInt("<%= @siswa.skor_uas %>"), label: "UTS"}, { y: parseInt("<%= @siswa.rata_rata %>"), label: "Rata-rata"} ] } ] }; $("#grafik_siswa").CanvasJSChart(graph); }); $(function() { var ctx = document.getElementById("grafik_siswa2"); var myChart = new Chart(ctx, { type: 'bar', data: { labels: ["UAS", "UTS", "Rata-rata"], datasets: [{ label: '# Nilai ', data: [parseInt("<%= @siswa.skor_uts %>"), parseInt("<%= @siswa.skor_uas %>"), parseInt("<%= @siswa.rata_rata %>")], backgroundColor: [ 'rgba(255, 99, 132, 0.2)', 'rgba(54, 162, 235, 0.2)', 'rgba(255, 206, 86, 0.2)' ], borderColor: [ 'rgba(255,99,132,1)', 'rgba(54, 162, 235, 1)', 'rgba(255, 206, 86, 1)' ], borderWidth: 1 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true } }] }, title: { display: true, text: 'Grafik Nilai <%= @siswa.nama %>', fontSize: 24 }, tooltips: { enabled: true, mode: 'single', callbacks: { label: function(tooltipItems, data) { var ylabel = tooltipItems.yLabel; return " # Nilai : " + ylabel; } } } } }); }); </script> - The following is a display of the chart that appears on the display page

PakarPBN
A Private Blog Network (PBN) is a collection of websites that are controlled by a single individual or organization and used primarily to build backlinks to a “money site” in order to influence its ranking in search engines such as Google. The core idea behind a PBN is based on the importance of backlinks in Google’s ranking algorithm. Since Google views backlinks as signals of authority and trust, some website owners attempt to artificially create these signals through a controlled network of sites.
In a typical PBN setup, the owner acquires expired or aged domains that already have existing authority, backlinks, and history. These domains are rebuilt with new content and hosted separately, often using different IP addresses, hosting providers, themes, and ownership details to make them appear unrelated. Within the content published on these sites, links are strategically placed that point to the main website the owner wants to rank higher. By doing this, the owner attempts to pass link equity (also known as “link juice”) from the PBN sites to the target website.
The purpose of a PBN is to give the impression that the target website is naturally earning links from multiple independent sources. If done effectively, this can temporarily improve keyword rankings, increase organic visibility, and drive more traffic from search results.
