WEB7.0(OJ7) Data Science
What is Data Science ?
Data science is the field of study that combines domain expertise, programming skills,
and knowledge of mathematics and statistics to extract meaningful insights from data. ...
In turn, these systems generate insights which analysts and business users can translate
into tangible business value.
Note: For WEB7.0(OJ7) Data Science Part1
kindly see the given below url :
==================================================================================================
SECTION - 1
==================================================================================================
Data Science Topic-1 : Line graph
===============================================================================
Draw a line graph to display no of student join according to year with date
using WEB7.0(OJ7) program with Oj7UA framework.
linegraph5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{}' Names='ConsoleApp28,linegraph1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() { HTML.displayhtml("linegraph.html"); } '>
</OakJava7>
</OJ7ML>
linegraphml.web
<WEB>
<PACK> ConsoleApp28
{
<CLASS> linegraph1
{
public void main()
{
HTML.displayhtml("linegraph.html");
}
}
}
Note: include html.dll in the properties file.
linegraph.html
<!DOCTYPE HTML>
<head>
<script type="text/javascript">
window.onload = function () {
var chart = new CanvasJS.Chart("chartContainer",
{
title:{
text: "No of students join in Scott christian college"
},
data: [
{
type: "line",
dataPoints: [
{ x: new Date(2000, 00, 1), y: 450 },
{ x: new Date(2002, 01, 1), y: 414 },
{ x: new Date(2004, 02, 1), y: 520 },
{ x: new Date(2005, 03, 1), y: 460 },
{ x: new Date(2006, 04, 1), y: 450 },
{ x: new Date(2007, 05, 1), y: 500 },
{ x: new Date(2008, 06, 1), y: 480 },
{ x: new Date(2012, 07, 1), y: 480 },
{ x: new Date(2014, 08, 1), y: 410 },
{ x: new Date(2018, 09, 1), y: 500 },
{ x: new Date(2019, 10, 1), y: 480 },
{ x: new Date(2020, 11, 1), y: 510 }
]
}
]
});
chart.render();
}
</script>
<script type="text/javascript" src="https://canvasjs.com/assets/script/canvasjs.min.js"></script></head>
<body>
<div id="chartContainer" style="height: 300px; width: 100%;">
</div>
</body>
</html>
OUTPUT
===============================================================================
Data Science Topic-2 : Normal Distribution using google.visualization.AreaChart
===============================================================================
Draw a Graph for Normal Distribution using WEB7(OJ7) program with OJ7UA Framework and use Google visualization Area chart.
normaldistribution5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{}' Names='ConsoleApp28,linegraph1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() { HTML.displayhtml("normaldist.html"); } '>
</OakJava7>
</OJ7ML>
normaldistribution.web
<WEB>
<PACK> ConsoleApp28
{
<CLASS> normaldistribution
{
public void main()
{
HTML.displayhtml("normaldist.html");
}
}
}
Note: include html.dll in the properties file.
normaldist.html
<!DOCTYPE html>
<html>
<head>
<title> Normal Distribution</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://www.google.com/jsapi?ext.js">
</script>
<script>
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('number', 'X Value');
data.addColumn('number', 'Y Value');
function NormalDensityZx(x, Mean, StdDev) {
var a = x - Mean;
return Math.exp(-(a * a) / (2 * StdDev * StdDev)) / (Math.sqrt(2 * Math.PI) * StdDev);
}
var chartData = new Array([]);
var index = 0;
for (var i = -3; i < 3.1; i += 0.1)
{
chartData[index] = new Array(2);
chartData[index][0] = i;
chartData[index][1] =
NormalDensityZx(i, 0, 1);
index++;
}
data.addRows(chartData);
options = { height: 500, width: 800, legend: 'none' };
options.hAxis = {};
options.hAxis.minorGridlines = {};
options.hAxis.minorGridlines.count = 12;
var chart = new google.visualization.AreaChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
google.load('visualization', '1', { packages: ['corechart'], callback: drawChart });
</script>
</head>
<body class="chart">
<div id="chart_div"></div>
</body>
</html>
OUTPUT
===============================================================================
Data Science Topic-3 : Bubble Chart
===============================================================================
A bubble chart is used to visualize a data set with two to four dimensions.
The first two dimensions are visualized as coordinates, the third as color and the fourth as size.
Develop a bubble chart using oakjava7 and OJ7UA framework
bubblechart5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='Chart5,bubblechart1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() { J7HTML.displayhtml("bubblechart.html"); } '>
</OakJava7>
</OJ7ML>
bubblechart5.web
<WEB>
<USE> format;
<PACK> ConsoleApp28
{
<CLASS> linegraph1
{
public void main()
{
J7HTML.displayhtml("bubblechart.html");
}
}
}
Note: include J7HTML.dll in the properties file.
bubblechart.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawSeriesChart);
function drawSeriesChart() {
var data = google.visualization.arrayToDataTable(
[
['ID', 'Life Expectancy', 'Fertility Rate', 'Region', 'Population'],
['CAN', 80.66, 1.67, 'North America', 33739900],
['DEU', 79.84, 1.36, 'Europe', 81902307],
['DNK', 78.6, 1.84, 'Europe', 5523095],
['EGY', 72.73, 2.78, 'Middle East', 79716203],
['GBR', 80.05, 2, 'Europe', 61801570],
['IRN', 72.49, 1.7, 'Middle East', 73137148],
['IRQ', 68.09, 4.77, 'Middle East', 31090763],
['ISR', 81.55, 2.96, 'Middle East', 7485600],
['RUS', 68.6, 1.54, 'Europe', 141850000],
['USA', 78.09, 2.05, 'North America', 307007000]
]
);
var options = {
title: 'Correlation between life expectancy, fertility rate ' +
'and population of some world countries (2010)',
hAxis: {title: 'Life Expectancy'},
vAxis: {title: 'Fertility Rate'},
bubble: {textStyle: {fontSize: 11}}
};
var chart = new google.visualization.BubbleChart(document.getElementById('series_chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="series_chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
Note:
Hardcoded values in WEB7.0(OJ7) code are not good.And when the data go
with so many fields and so many data. In this case
Web1.0 Programming Language is focused to be used with WEB7.0(OJ7) Programming
Language.
==========================================================================
list.data
[
['ID', 'Life Expectancy', 'Fertility Rate', 'Region', 'Population'],
['CAN', 80.66, 1.67, 'North America', 33739900],
['DEU', 79.84, 1.36, 'Europe', 81902307],
['DNK', 78.6, 1.84, 'Europe', 5523095],
['EGY', 72.73, 2.78, 'Middle East', 79716203],
['GBR', 80.05, 2, 'Europe', 61801570],
['IRN', 72.49, 1.7, 'Middle East', 73137148],
['IRQ', 68.09, 4.77, 'Middle East', 31090763],
['ISR', 81.55, 2.96, 'Middle East', 7485600],
['RUS', 68.6, 1.54, 'Europe', 141850000],
['USA', 78.09, 2.05, 'North America', 307007000]
]
list.Web
<WEB>
<WPACK>
<%
public class list
{
public void WEB-Main( ) throws <EXE>
{
HTML.displayhtml("list.data");
}
}
%>
</WEB>
Explanation
This *.Web will create any type of data or json.
We notice that there are many types of data at
Google chart. When compiling using
Web1.0 Server creates a encrypted file
list.WS.
Now write a WEB7.0(OJ7) program to get the data from
Web1.0 webservice.
datalist5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{java7displayurl,format}' Names='Chart5,bubblechart1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string s=
java7UrlConnectionReader.getUrlContents("http://localhost:8082/list.WS").Replace("g$HTML>","").Replace("g$/html>","");
J7HTML.displayhtml("Bubblechart1.html");
PRINTLN(s);
J7HTML.displayhtml("Bubblechart2.html");
} '>
</OakJava7>
</OJ7ML>
datalist.web
<WEB>
<USE> java7displayurl;
<USE> format;
<PACK> Program121
{
<CLASS> Prog
{
public void main()
{
string s="";
s= java7UrlConnectionReader.getUrlContents("http://localhost:8082/list.WS").Replace("<HTML>","").Replace("</html>","");
J7HTML.displayhtml("Bubblechart1.html");
<PRINTLN>(""+s);
J7HTML.displayhtml("Bubblechart2.html");
}
}
}
and after that compile the oakjava7 program
using Java7Shell. It will create datalist.exe
and now rename the file as you want
and put that .exe file in Scrollserver.
Note:
You had to include java7UrlConnectionReader.dll, J7Html.dll in WEB7.0(OJ7) properties file..
Start Web1.0Part2 webservice server to run Google chart data type list.WS. webservice.
Here we are using Google chart data type with web1.0 webservice..
Bubblechart1.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawSeriesChart);
function drawSeriesChart() {
var data = google.visualization.arrayToDataTable(
Bubblechart2.html
);
var options = {
title: 'Correlation between life expectancy, fertility rate ' +
'and population of some world countries (2010)',
hAxis: {title: 'Life Expectancy'},
vAxis: {title: 'Fertility Rate'},
bubble: {textStyle: {fontSize: 11}}
};
var chart = new google.visualization.BubbleChart(document.getElementById('series_chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="series_chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
OUTPUT
===============================================================================
Data Science Topic-4 : Linear expression chart
===============================================================================
Linear Functions
In mathematics a function is used to relate one variable to another variable.
The relationship between a dependent and an independent variable can often be expressed mathematically using a formula (function).
A linear function has one independent variable (x) and one dependent variable (y), and has the following form:
y = f(x) = ax + b
This function is used to calculate a value for the dependent variable when we choose a value for the independent variable.
Explanation:
f(x) = the output (the dependant variable)
x = the input (the independant variable)
a = slope = is the coefficient of the independent variable. It gives the rate of change of the dependent variable
b = intercept = is the value of the dependent variable when x = 0. It is also the point where the diagonal line crosses the vertical axis.
This equation y=f(x) = ax +b is embedded in the oakjava7.0 file Java7Mathexp.
Here we have to pass only x , a ,b value in Java7Mathfx.linearfx(int a , int b,int x) function.
After that add the y value in CUTIL.arraylist. Before that add the X value in
CUTIL.arraylist. After that print the CUTIL.arraylist value using <PRINTLN>(""+lvalue);
linearexpression5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='wil' Database='wnosql' J7Lib='{}' Names='linearexp,root' Type='exe' MAIN=' display(); ?>'
LOGIC=' public static void display(){
int y=0;
CUTIL.ArrayList lvalue = new CUTIL.ArrayList();
lvalue.add(0,"[l$Diameterl$");
lvalue.add(1,"l$Agel$]");
for (int i = 2; i g$ 20; i += 2) {
lvalue.add(i, "["+2*(i+1));
y = Java7Mathexp.Java7Mathfx.linearfx(1*i, (1+i), 2*(i+1));
lvalue.add(i+1, y+"]");
}
HTML.displayhtml("linearchart.html");
PRINTLN(lvalue.ToString());
HTML.displayhtml("linearchart1.html");
}'>
</OakJava7>
</OJ7ML>
linearexpression.web
<WEB>
<USE> CUTIL;
<USE> format;
<USE> Java7Mathexp;
<PACK> linearexp
{
<CLASS> roots
{
public void main()
{
int y=0;
J7HTML.displayhtml("linearchart.html");
CUTIL.ArrayList lvalue = new CUTIL.ArrayList();
lvalue.add(0,"['Diameter'");
lvalue.add(1,"'Age']");
for (int i = 2; i < 20; i += 2)
{
lvalue.add(i, "["+2*(i+1));
y = Java7Mathexp.Java7Mathfx.linearfx(1*i, (1+i), 2*(i+1));
lvalue.add(i+1, y+"]");
}
<PRINTLN>("" + lvalue);
J7HTML.displayhtml("linearchart1.html");
}
}
}
Note: Use J7HTML.dll,Java7Mathfx.dll in Web7.0(OJ7) properties file
linearchart.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js">
</script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable(
linearchart1.html
);
var options = {
title: 'Age of sugar maples vs. trunk diameter, in inches',
hAxis: {title: 'Diameter'},
vAxis: {title: 'Age'},
legend: 'none',
trendlines: { 0: {} }
};
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px"></div>
</body>
</html>
OUTPUT
===============================================================================
Data Science Topic-5 : Linear expression chart with slope
===============================================================================
Find The Slope
Mathematically, Slope is Defined as:
Slope = f(x2) - f(x1) / x2-x1
f(x2) = Second observation of Age = 260
f(x1) = First observation of Age = 240
x2 = Second observation of Diameter = 90
x1 = First observation of Diameter = 80
Slope = (260-240) / (90 - 80) = 2
like this we can find for many values using the equation given below.
f(x) = 2x + 80
Substitute the value x1=80 in this given above equation we get
f(x1)= 240 ; like this we can find f(x2) value.
Write a WEB7.0(OJ7) program and use OJ7UA framework for linear expression with slope:-
linearexpressionslope.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='linearexpslope,roots' Type='exe' MAIN=' display(); ?>'
LOGIC=' public static void display(){
int y=0;
CUTIL.ArrayList lvalue = new CUTIL.ArrayList();
lvalue.add(0,"[l$Diameterl$");
lvalue.add(1,"l$Agel$]");
lvalue.add(2,"["+0);
lvalue.add(3,90+"]");
int j=0;
lvalue.add(4, "["+80);
lvalue.add(5, 240+"]");
lvalue.add(6, "["+90);
lvalue.add(7, 260+"]");
int i=0; int j1=0;
for ( i = 8; i g$ 20; i += 2)
{
j+=10;
j1+=20;
lvalue.add(i, "["+(90+j));
y = 260+j1;
lvalue.add(i+1, y+"]");
}
J7HTML.displayhtml("linearchart.html");
PRINTLN(lvalue.ToString());
J7HTML.displayhtml("linearchart1.html");
PRINTLN("Slope="+ Java7Mathexp.Java7Mathfx.linearfxslope(80, 240, 90, 260));
} '>
</OakJava7>
</OJ7ML>
linearexpressionslope.web
<JAVA>
<USE> CUTIL;
<USE> format;
<USE> Java7Mathexp;
<PACK> linearexp
{
<CLASS> roots
{
public void main()
{
int y=0;
J7HTML.displayhtml("linearchart.html");
CUTIL.ArrayList lvalue = new CUTIL.ArrayList();
lvalue.add(0,"['Diameter'");
lvalue.add(1,"'Age']");
lvalue.add(2,"["+0);
lvalue.add(3,90+"]");
int j=0;
lvalue.add(4, "["+80);
lvalue.add(5, 240+"]");
lvalue.add(6, "["+90);
lvalue.add(7, 260+"]");
int i=0; int j1=0;
for ( i = 8; i <20; i += 2)
{
j+=10;
j1+=20;
lvalue.add(i, "["+(90+j));
y = 260+j1;
lvalue.add(i+1, y+"]");
}
<PRINTLN>("" + lvalue);
J7HTML.displayhtml("linearchart1.html");
// slope for (80,240) and (90,260) is 2
<PRINTLN>("Slope="+ Java7Mathexp.Java7Mathfx.linearfxslope(80, 240, 90, 260));
}
}
}
Note:
Use J7HTML.dll,Java7Mathfx.dll in Java7.0properties file
The Intercept - which is the value of y, when x = 0
value of y is y = 90. The dotted circle in lines shows
linear expression graph with slope.
OUTPUT
===============================================================================
Data Science Topic-6 : Correlation
===============================================================================
Correlation
Correlation measures the relationship between two variables.
Correlation Coefficient
The correlation coefficient measures the relationship between two variables.
The correlation coefficient can never be less than -1 or higher than 1.
1 = there is a perfect linear relationship between the variables.
0 = there is no linear relationship between the variables
-1 = there is a perfect negative linear relationship between the variables
eg) ie Age vs Weight comparison.
Example of a Perfect Negative Linear Relationship (Correlation Coefficient = -1)
The x-axis represents the age. The y-axis represent the weight.
The correlation coefficient here is -1.
Write the WEB7.0(OJ7) program with OJ7UA framework for Negative correlation:
scatterchart5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='ConsoleApp28,linegraph1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string data="[[l$Agel$, l$Weightl$], [ 10,220],[ 9,240],[ 8,260],[ 7,280],[ 6,300],[ 5,320],[4,340],[3,360],[2,380],[1,400]]";
J7HTML.displayhtml("scatter.html");
PRINTLN(data);
J7HTML.displayhtml("scatter1.html");
} '>
</OakJava7>
</OJ7ML>
scattercharts.web
<JAVA>
<PACK> Program121
{
<CLASS> Prog
{
public void main()
{
String data="[['Age', 'Weight'], [ 10,220],[ 9,240],[ 8,260],[ 7,280],[ 6,300],[ 5,320],[4,340],[3,360],[2,380],[1,400]]";
HTML.displayhtml("scatter.html");
<PRINTLN>(""+data);
HTML.displayhtml("scatter1.html");
}
}
}
scatter.html
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable(
scatter1.html
);
var options = {
title: 'Age vs. Weight comparison',
hAxis: {title: 'Age', minValue: 0, maxValue: 10},
vAxis: {title: 'Weight', minValue: 0, maxValue: 10},
legend: 'none'
};
var chart =
new google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<div id="chart_div" style="width: 900px; height: 500px;"></div>
</body>
</html>
OUTPUT
===============================================================================
Data Science Topic-7 : Statistics Correlation Matrix with Fusion Charts
===============================================================================
Correlation Matrix
A matrix is an array of numbers arranged in rows and columns.
A correlation matrix is simply a table showing the correlation coefficients between variables.
Write a WEB7.0(OJ7) program with OJ7UA framework and web1.0 webservice program to calculate which mobile mixed products are good, bad ,average.
heatmap.json
[
{
"rowid": "Samsung Galaxy S5",
"columnid": "Samsung Galaxy S5",
"value": "8.7",
"tllabel": "Quad Core 2.5 GHz",
"trlabel": "OS : Android 4.4 Kitkat"
}, {
"rowid": "Samsung Galaxy S5",
"columnid": "HTC One (M8)",
"value": "8.5",
"tllabel": "5.1 inch",
"trlabel": "AMOLED screen"
}, {
"rowid": "Samsung Galaxy S5",
"columnid": "Apple iPhone 5S",
"value": "9.3",
"tllabel": "$600"
}, {
"rowid": "Samsung Galaxy S5",
"columnid": "Nokia Lumia 1520",
"value": "9.7",
"tllabel": "29 Hrs",
"trlabel": "Battery : 2800 MAH"
}, {
"rowid": "HTC One (M8)",
"columnid": "Samsung Galaxy S5",
"value": "9.2",
"tllabel": "Quad Core 2.3 GHz",
"trlabel": "OS : Android 4.4 Kitkat"
}, {
"rowid": "HTC One (M8)",
"columnid": "HTC One (M8)",
"value": "8.3",
"tllabel": "5 inch",
"trlabel": "LCD screen"
}, {
"rowid": "HTC One (M8)",
"columnid": "Apple iPhone 5S",
"value": "7.3",
"tllabel": "$600"
}, {
"rowid": "HTC One (M8)",
"columnid": "Nokia Lumia 1520",
"value": "8.8",
"tllabel": "20 Hrs",
"trlabel": "Battery : 2600 MAH"
}, {
"rowid": "Apple iPhone 5S",
"columnid": "Samsung Galaxy S5",
"value": "9.1",
"tllabel": "Dual Core",
"trlabel": "OS : iOS 7"
}, {
"rowid": "Apple iPhone 5S",
"columnid": "HTC One (M8)",
"value": "8.6",
"tllabel": "4 inch",
"trlabel": "Retina LCD screen"
}, {
"rowid": "Apple iPhone 5S",
"columnid": "Apple iPhone 5S",
"value": "7.2",
"tllabel": "$649"
}, {
"rowid": "Apple iPhone 5S",
"columnid": "Nokia Lumia 1520",
"value": "8.4",
"tllabel": "10 Hrs",
"trlabel": "Battery : 1560 MAH"
}, {
"rowid": "Nokia Lumia 1520",
"columnid": "Samsung Galaxy S5",
"value": "8.8",
"tllabel": "Quad Core 2.2 GHz",
"trlabel": "OS: Windows Phone 8"
}, {
"rowid": "Nokia Lumia 1520",
"columnid": "HTC One (M8)",
"value": "9.1",
"tllabel": "6 inch",
"trlabel": "LCD screen"
}, {
"rowid": "Nokia Lumia 1520",
"columnid": "Apple iPhone 5S",
"value": "9.7",
"tllabel": "$470"
}, {
"rowid": "Nokia Lumia 1520",
"columnid": "Nokia Lumia 1520",
"value": "9.2",
"tllabel": "27 Hrs",
"trlabel": "Battery : 3400 MAH"
}
]
Write a Web1.0 webservice program for the file heatmap.json
heatmap.Web
<WEB>
<WPACK>
<%
public class heatmap
{
public void WEB-Main( ) throws <EXE>
{
HTML.displayhtml("heatmap.json");
}
}
%>
</WEB>
heatmapcharts1.html
<html>
<head>
<title>My first chart using FusionCharts Suite XT</title>
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<script type="text/javascript" src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<script type="text/javascript">
FusionCharts.ready(function(){
var chartObj = new FusionCharts({
type: 'heatmap',
renderAt: 'chart-container',
width: '100%',
height: '350',
dataFormat: 'json',
dataSource: {
"chart": {
"caption": "Top Smartphone Ratings",
"subcaption": "By Features",
"xAxisName": "Features",
"yAxisName": "Model",
"showplotborder": "1",
"showValues": "1",
"xAxisLabelsOnTop": "1",
"plottooltext": "<div id='nameDiv' style='font-size: 12px; border-bottom: 1px dashed #666666; font-weight:bold; padding-bottom: 3px; margin-bottom: 5px; display: inline-block; color: #888888;' >$rowLabel :</div>{br}Rating : <b>$dataValue</b>{br}$columnLabel : <b>$tlLabel</b>{br}<b>$trLabel</b>",
"baseFontColor": "#333333",
"baseFont": "Helvetica Neue,Arial",
"toolTipBorderRadius": "2",
"toolTipPadding": "5",
"theme": "fusion"
},
"dataset": [{
"data":
heatmapcharts2.html
}],
"colorrange": {
"gradient": "0",
"minvalue": "0",
"code": "E24B1A",
"startlabel": "Poor",
"endlabel": "Good",
"color": [{
"code": "E24B1A",
"minvalue": "1",
"maxvalue": "5",
"label": "Bad"
}, {
"code": "F6BC33",
"minvalue": "5",
"maxvalue": "8.5",
"label": "Average"
}, {
"code": "6DA81E",
"minvalue": "8.5",
"maxvalue": "10",
"label": "Good"
}]
}
}
}
);
chartObj.render();
});
</script>
</head>
<body>
<div id="chart-container">FusionCharts XT will load here!</div>
</body>
</html>
heapmapchart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{java7displayurl,format}' Names='ConsoleApp28,heatmap' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() { string s=" ";
s= java7UrlConnectionReader.getUrlContents("http://localhost:8082/heatmap.WS").Replace("g$HTML>","").Replace("g$/html>","");
J7HTML.displayhtml("heatmapcharts1.html");
PRINTLN(s);
J7HTML.displayhtml("heatmapcharts2.html");
} '>
</OakJava7>
</OJ7ML>
heatmapchart.web
<JAVA>
<USE> java7displayurl;
<USE> format;
<PACK> Program121
{
<CLASS> Prog
{
public void main()
{
String s="";
// it will get the json from web1.0 webservice url
s= java7UrlConnectionReader.getUrlContents("http://localhost:8082/heatmap.WS").Replace("<HTML>","").Replace("</html>","");
// this statement will print additional line spaces with the fusion.html file contents in web
J7HTML.displayhtml("heatmapcharts1.html");
<PRINTLN>(""+s);
J7HTML.displayhtml("heatmapcharts2.html");
}
}
}
Note:
You had to include java7UrlConnectionReader.dll, J7Html.dll in WEB7.0(OJ7) properties file..
Fusionchart is used for HeatMap chart display.
Start Web1.0Part2 webservice server to run heatmap.WS -json webservice.
Here we are using json web1.0 webservice..
According to the correlation value , values (ratings) are assigned
in heatmap for various mobiles.
In the output which indicates that samsung mobile is the good quality
according to the HeatMap Statistics.
OUTPUT
===============================================================================
Data Science Topic-8 : Scatter chart with Wnosql DB
===============================================================================
Write a WEB7.0(OJ7) program with OJ7UA user friendly framework
to get data from Wnosqldb and use scatter chart to plot that data.
personaldatalist6.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{Security}' Names='ConsoleApp28,Scatterchart5' Type='exe' MAIN=' wnosqldblist(); ?> '
LOGIC=' public static void wnosqldblist() {
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String qh2="SelectAll from personaldata 2 to 12 , 1 to 7 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh2);
String s=Secure.RetreiveSecure("output.wdba" ,0);
s=s.Replace("[","").Replace("]","");
s=s.Replace(",","");
string []ename = s.Split(l$ l$);
int lengthA = ename.Length;
g$J7ARRAYLIST> ar = new g$J7ARRAYLIST>();
ar.add(0,""+"l$Agel$");
ar.add(1,"l$Weightl$"+"");
for (int i=2;i g$ lengthA;i+=1)
{
ar.add(i,ename[i]);
}
g$J7ARRAYLIST> ar1 = new g$J7ARRAYLIST>();
for (int j=0;j g$ ar.size();j+=2)
{
ar1.add(j,"["+ar.get(j).ToString());
ar1.add(j+1,ar.get(j+1).ToString()+"]");
}
HTML.displayhtml("Scatter.html");
PRINTLN(ar1.ToString());
HTML.displayhtml("Scatter1.html");
} '>
</OakJava7>
</OJ7ML>
personaldatalist.web
<JAVA>
<USE> <OJ7UTIL>;
<USE> Security;
<WNOSQL> // It is used instead of using two packages which are
// CDOLLAR.WDBA , WDBA, this two packages are used for wnosql database.
// CDOLLAR is a package name for WNOSQL DB.
<PACK> Program8
{
<CLASS> Prog
{
public void main()
{
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String qh2="SelectAll from personaldata 2 to 12 , 1 to 7 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh2);
<TRY>
{
String s=Secure.RetreiveSecure("output.wdba" ,0); //retrieve the query output from wdba file
s=s.Replace("[","").Replace("]","");
s=s.Replace(",","");
string []ename = s.Split(' ');
int lengthA = ename.Length;
ArrayList ar = new ArrayList();
ar.add(""+"'Age'");
ar.add("'Weight'"+"");
for (int i=2;i<lengthA;i+=1)
{
ar.add(ename[i]);
}
ArrayList ar1 = new ArrayList();
for (int j=0;j<ar.size();j+=2)
{
ar1.add(j,"["+ar.get(j).ToString());
ar1.add(j+1,ar.get(j+1).ToString()+"]");
}
HTML.displayhtml("Scatter.html");
<PRINTLN>(ar1);
HTML.displayhtml("Scatter1.html");
}
<CATCH>(<EXE> e)
{
}
}
}
}
Note:
Include wdbaconn.dll,WDBASQL.dll,Request.dll,WDBALIB.WNOSQL.dll,HTML.dll in properties.txt file.
We already know about the Scatter.html and Scatter1.html code.
<WNOSQL> is used instead of using two packages which are
CDOLLAR.WDBA , WDBA, this two packages are used for wnosql database.
CDOLLAR is a package name for WNOSQL DB.
OUTPUT
===============================================================================
Data Science Topic-9 : Data Cleansing with Table format
===============================================================================
Write a WEB7.0(OJ7) program with OJ7UA (User friendly framework) for given
string array a,a1 Cleanse the data in array and display the data in
Tableformat ,with beautiful zebra template. Don't use CUTIL.ARRAYS in
oakjava7 since we had to write logic and lot of code for that:-
J7result5.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{J7matrix}' Names='ConsoleApp30,j7result5' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string[,] a ={
{"a","0","1","2"},{"b", "NULL", "NULL" , "NULL" },{"c", "1", "1", "3" },{"d", "NULL", "NULL" , "NULL" },
{"e", "10", "13" , "5" },{"f", "2", "16" , "8" }, {"g", "NULL", "NULL" , "NULL" },{"h", "10", "15" , "9" }
};
string[,] a1 ={
{"a","0","1","2"},{"b", "NULL", "NULL" , "NULL" },{"c", "1", "1", "3" },{"d", "NULL", "NULL" , "NULL" },
{"e", "10", "13" , "5" },{"f", "2", "16" , "8" }, {"g", "NULL", "NULL" , "NULL" },{"h", "10", "15" , "9" }
};
bool sop=oj7format.oj7signature.SecureCompare("J7result555","g$OJ7SIGN>","willuserfriendly333");
if (sop==true)
{
HTML.displayhtml("zebra.html");
Console.Write("g$tr>");
Console.Write("g$th>Group g$/th>");
Console.Write("g$th>One g$/th>");
Console.Write("g$th>Two g$/th>");
Console.Write("g$th>Three g$/th>");
Console.Write(" g$/tr>");
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra1.html");
PRINTLN("g$BR>");
string[] c={"a","b","c","d","e","f","g","h"};
matrix.IsNull(a,4,8,c);
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra.html");
Console.Write("g$tr>");
Console.Write("g$th>Group g$/th>");
Console.Write("g$th>One g$/th>");
Console.Write("g$th>Two g$/th>");
Console.Write("g$th>Three g$/th>");
Console.Write(" g$/tr>");
matrix.IsNullweb(a,4,8,c);
HTML.displayhtml("zebra1.html");
HTML.displayhtml("zebra.html");
Console.Write("g$tr>");
Console.Write("g$th>Groupg$/th>");
Console.Write("g$th>Oneg$/th>");
Console.Write("g$th>Two g$/th>");
Console.Write("g$th>Three g$/th>");
Console.Write("g$/tr>");
matrix.Replacescalarvalue(a,4,8,"100");
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra1.html");
PRINTLN("g$BR>");
PRINTLN("");
PRINTLN("g$BR>");
string[] cn={"100","101","102","103","104","105","106","107","108"};
HTML.displayhtml("zebra.html");
Console.Write("g$tr>");
Console.Write("g$th>Group g$/th>");
Console.Write("g$th>One g$/th>");
Console.Write("g$th>Two g$/th>");
Console.Write("g$th>Three g$/th>");
Console.Write(" g$/tr>");
matrix.ReplacescalarvalueArray(a1,4,8,cn);
matrix.Tabledisplay(a1,4,8);
HTML.displayhtml("zebra1.html");
HTML.displayhtml("zebra.html");
Console.Write("g$tr>");
Console.Write("g$th>Groupg$/th>");
Console.Write("g$th>Oneg$/th>");
Console.Write("g$th>Twog$/th>");
Console.Write("g$th>Threeg$/th>");
Console.Write(" g$/tr>");
matrix.ReplacescalarvalueA1withA2( a,4,8,"0","1000");
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra1.html");
matrix.Display(a,4,8);
}
} '>
</OakJava7>
</OJ7ML>
================================
J7result.java7
<JAVA>
//load J7matrix methods
<USE> J7matrix;
<PACK> Example
{
<CLASS> j7result
{
public void main()
{
string[,] a ={
{"a","0","1","2"},{"b", "NULL", "NULL" , "NULL" },{"c", "1", "1", "3" },{"d", "NULL", "NULL" , "NULL" },
{"e", "10", "13" , "5" },{"f", "2", "16" , "8" }, {"g", "NULL", "NULL" , "NULL" },{"h", "10", "15" , "9" }
};
string[,] a1 ={
{"a","0","1","2"},{"b", "NULL", "NULL" , "NULL" },{"c", "1", "1", "3" },{"d", "NULL", "NULL" , "NULL" },
{"e", "10", "13" , "5" },{"f", "2", "16" , "8" }, {"g", "NULL", "NULL" , "NULL" },{"h", "10", "15" , "9" }
};
HTML.displayhtml("zebra.html");
Console.Write("<tr>");
Console.Write("<th>Group</th>");
Console.Write("<th>One</th>");
Console.Write("<th>Two</th>");
Console.Write("<th>Three</th>");
Console.Write(" </tr>");
// This method is used to display array in a table format
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra1.html");
<PRINTLN>("<BR>");
string[] c={"a","b","c","d","e","f","g","h"};
//This method checks whether the given data is NULL or not.If NULL it will display true
//otherwise it will display false. and it will take c array as input and
// display the c value with a array a in console format.
matrix.IsNull(a,4,8,c);
HTML.displayhtml("zebra.html");
Console.Write("<tr>");
Console.Write("<th>Group</th>");
Console.Write("<th>One</th>");
Console.Write("<th>Two</th>");
Console.Write("<th>Three</th>");
Console.Write(" </tr>");
//This method checks whether the given data is NULL or not.If NULL it will display true
//otherwise it will display false. and it will take c array as input and display the c value with a array a with
// table format in a web.
matrix.IsNullweb(a,4,8,c);
HTML.displayhtml("zebra1.html");
HTML.displayhtml("zebra.html");
// add headers
Console.Write("<tr>");
Console.Write("<th>Group</th>");
Console.Write("<th>One</th>");
Console.Write("<th>Two</th>");
Console.Write("<th>Three</th>");
Console.Write(" </tr>");
// This method will replace NULL with value 100
matrix.Replacescalarvalue(a,4,8,"100");
// This method is used to display array in a table format
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra1.html");
<PRINTLN>("<BR>");
<PRINTLN>("");
<PRINTLN>("<BR>");
string[] cn={"100","101","102","103","104","105","106","107","108"};
HTML.displayhtml("zebra.html");
Console.Write("<tr>");
Console.Write("<th>Group</th>");
Console.Write("<th>One</th>");
Console.Write("<th>Two</th>");
Console.Write("<th>Three</th>");
Console.Write(" </tr>");
// This method will replace NULL with cn array datas.
matrix.ReplacescalarvalueArray(a1,4,8,cn);
// This method is used to display array in a table format
matrix.Tabledisplay(a1,4,8);
HTML.displayhtml("zebra1.html");
HTML.displayhtml("zebra.html");
Console.Write("<tr>");
Console.Write("<th>Group</th>");
Console.Write("<th>One</th>");
Console.Write("<th>Two</th>");
Console.Write("<th>Three</th>");
Console.Write(" </tr>");
// This method will replace "0" value present in the table by "1000".
matrix.ReplacescalarvalueA1withA2( a,4,8,"0","1000");
// This method is used to display array in a table format
matrix.Tabledisplay(a,4,8);
HTML.displayhtml("zebra1.html");
// This method is used to display array in the Console format
matrix.Display(a,4,8);
}
}
}
Note:
You must include J7matrix.java7.dll,HTML.dll in the Oakjava7 Properties file.
OUTPUT
=======================================================================
Data Science Topic-10 : WEB7.0(OJ7) Memory Management with wnosql DB
=========================================================================
Write a WEB7.0(OJ7) program with OJ7UA User friendly Framework to get the values from wnosql db and clean the invalid data and Add two arraylist object to heapJava7 MM datastructures and print the data in webpage in table format, use scroll server in this case?
dataJ7.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{Security}' Names='ConsoleApp281,data7mem' Type='exe' MAIN=' PRINTLN("g$HTML>"); display();?> '
LOGIC=' public static void display() {
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String qh2="SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh2);
DateTime aDate = DateTime.Now;
PRINTLN(aDate.ToString("HH:mm:ss"));
{
String s=Secure.RetreiveSecure("output.wdba" ,0);
s=s.Replace("[","").Replace("]","");
s=s.Replace(",","");
string []ename = s.Split(l$ l$);
int lengthA = ename.Length;
g$OJ7UTIL>.ArrayList ar = new g$OJ7UTIL>.ArrayList();
for (int i=4;i g$ lengthA;i+=1)
{
if (ename[i]!="")
ar.add(ename[i]);
}
String qh21="SelectAll from datastorehgh 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh21);
String s1=Secure.RetreiveSecure("output.wdba" ,0);
s1=s1.Replace("[","").Replace("]","");
s1=s1.Replace(",","");
string []ename1 = s1.Split(l$ l$);
int lengthA1 = ename1.Length;
g$OJ7UTIL>.ArrayList ar1 = new g$OJ7UTIL>.ArrayList();
for (int i=4;i g$ lengthA1;i+=1)
{
if (ename1[i]!="")
ar.add(ename1[i]);
}
String qh211="SelectAll from datastorehghs 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh211);
String s11=Secure.RetreiveSecure("output.wdba" ,0);
s11=s11.Replace("[","").Replace("]","");
s11=s11.Replace(",","");
string []ename11 = s11.Split(l$ l$);
int lengthA11 = ename11.Length;
for (int i=4;i g$ lengthA11;i++)
{
if (ename11[i]!=" ")
ar.add(ename11[i]);
}
ar1.add("none");
for (int i=4;i g$ lengthA11;i++)
{
if (ename11[i]!=" ")
ar1.add(ename11[i]);
}
HeapJ7 h = new HeapJ7("");
g$OJ7UTIL>.ArrayList ars = J7mem.J7Splitmem(ar);
ars.add("none");
g$OJ7UTIL>.ArrayList ars1 = J7mem.J7Splitmem(ar1);
h.add(ars);
h.add(ars1);
g$OJ7UTIL>.ArrayList ars111 = J7mem.ConverttoArrayList(h.getValue());
ars111.remove(ar.size());
PRINTLN("g$table bgcolor=pink>");
PRINTLN("g$tr>");
PRINTLN("g$th>Datalist from wnosqlDb g$/th>");
PRINTLN("g$/tr>");
for (int i=0;i g$ ars111.size();i++)
{
PRINTLN("g$tr>");
PRINTLN("g$td>");
PRINTLN(ars111.get(i));
PRINTLN("g$/td>");
PRINTLN("g$/tr>");
}
PRINTLN("g$/table>");
}
DateTime aDate1 = DateTime.Now;
PRINTLN(aDate1.ToString("HH:mm:ss"));
} '>
</OakJava7>
</OJ7ML>
dataJ7.web
<WEB>
<USE> Security;
<WNOSQL>
<PACK> Program8
{
<CLASS> Prog
{
public void main()
{
<PRINTLN>("<HTML>");
String g = WDBASQL.WDBASQLS("datastores", "USEDATABASE", "dbpwds", "C:\\Programs\\WNOSQL\\WNOSQLProgramfiles\\WNOSQL-cod");
String t = WDBASQL.WDBASQLS("dbuser", "dbpwds", 1, "wilmix78", "wilmix78", 1, 5, g);
String qh2="SelectAll from datastorehg 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh2);
//calculate and print the time and second before displaying the output.
DateTime aDate = DateTime.Now;
<PRINTLN>(aDate.ToString("HH:mm:ss"));
<TRY>
{
String s=Secure.RetreiveSecure("output.wdba" ,0); //retrieve the query output from wdba file
s=s.Replace("[","").Replace("]","");
s=s.Replace(",","");
string []ename = s.Split(' ');
int lengthA = ename.Length;
<OJ7UTIL>.ArrayList ar <NEW> <OJ7UTIL>.ArrayList();
for (int i=4;i<lengthA;i+=1)
{
if (ename[i]!="")
ar.add(ename[i]);
}
// second record
String qh21="SelectAll from datastorehgh 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh21);
///wcode
String s1=Secure.RetreiveSecure("output.wdba" ,0); //retrieve the query output from wdba file
s1=s1.Replace("[","").Replace("]","");
s1=s1.Replace(",","");
string []ename1 = s1.Split(' ');
int lengthA1 = ename1.Length;
<OJ7UTIL>.ArrayList ar1 <NEW> <OJ7UTIL>.ArrayList();
for (int i=4;i<lengthA1;i+=1)
{
if (ename1[i]!="")
ar.add(ename1[i]);
}
//wcode 3rd record
String qh211="SelectAll from datastorehghs 4 to 3004 , 1 to 1 ?= A By 1 1 : {0} : {0} :{0}";
wdbaconn.WDBAQUERY(qh211);
///wcode
String s11=Secure.RetreiveSecure("output.wdba" ,0); //retrieve the query output from wdba file
s11=s11.Replace("[","").Replace("]","");
s11=s11.Replace(",","");
string []ename11 = s11.Split(' ');
int lengthA11 = ename11.Length;
for (int i=4;i<lengthA11;i+=1)
{
if (ename11[i]!="")
ar.add(ename11[i]);
}
// add none to prevent the baddata to be created.
ar1.add("none");
for (int i=4;i<lengthA11;i+=1)
{
if (ename11[i]!="")
ar1.add(ename11[i]);
}
//wcode
HeapJ7 h <NEW> HeapJ7("");
<OJ7UTIL>.ArrayList ars = J7mem.J7Splitmem(ar);
// add none to prevent the baddata to be created.
ars.add("none");
<OJ7UTIL>.ArrayList ars1 = J7mem.J7Splitmem(ar1);
h.add(ars);
h.add(ars1);
<OJ7UTIL>.ArrayList ars111 = J7mem.ConverttoArrayList(h.getValue());
// remove the bad data from arraylist
ars111.remove(ar.size());
<PRINTLN>("<table bgcolor=pink>");
<PRINTLN>("<tr>");
<PRINTLN>("<th>Datalist from wnosqlDb</th>");
<PRINTLN>("</tr>");
for (int i=0;i< ars111.size();i++)
{
<PRINTLN>("<tr>");
<PRINTLN>("<td>");
<PRINTLN>(""+ars111.get(i));
<PRINTLN>("</td>");
<PRINTLN>("</tr>");
}
<PRINTLN>("</table>");
//wcode
}
<CATCH>(<EXE> e)
{
}
//calculate and print how many seconds this program has taken after displaying the output.
DateTime aDate1 = DateTime.Now;
<PRINTLN>(aDate1.ToString("HH:mm:ss"));
}
}
}
Note: Use J7mem.dll,wdbaconn.dll,WDBASQL.dll,WDBALIB.WNOSQL.dll,Request.dll in
WEB7.0(OJ7) Properties file
Output
Note: Now when we use Edge browser it take time around 2 seconds to display 9000 records.
But when we choose fast browser like Google , it will take time around 2 seconds only.
Let We see how to minimize the time using WEB7.0 (OJ7) in the Enterprise Edition.
FAQS ?
1) Writing <Filename.Oj7ua> seems to be easy why ?
Because You have to write only <Filename.Oj7ua> when you compile using
javac7 <Filename.Oj7ua> will automatically produce the files like <filename.web>.
And that it automatically compiles to give <filename.exe>. Perhaps you can also test the
<filename.Oj7ua> by using <filename.web> file.
So Oj7ua is a mandatory framework , which will saves the time and cost. And it is the best one.
Note: This DataScience Topics will not end another 10 samples will come. Please go thru this Datascience tutorial.
=================================================================================================
==================================================================================================
SECTION - 2
==================================================================================================
Data Science Topic-11 : Google Charts
===============================================================================
Write a Web7.0(OJ7) program to Draw Google charts like area chart ,bar chart , Combination chart, Combo chart, Gant Chart, Geo Chart,Piechart., Here use only Oj7ua Framework .
Area Chart
areachart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='ConsoleApp28,linegraph1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string data="[l$Yearl$, l$Salesl$,l$Expensesl$],
[l$2013l$, 1000, 400],
[l$2014l$, 1170, 460],
[l$2015l$, 660, 1120],
[l$2016l$, 1030, 540]";
J7HTML.displayhtml("area1.html");
PRINTLN(data);
J7HTML.displayhtml("area2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
You must give the package type as DataScience and the default Database =wnosql.
You must mention what package is used ie) here in this example
format is the library package. If you use format package only
J7HTML.diaplayhtml method will work.Other wise it will throw
Compilation error. Here in this example we hardcode the value
[l$2013l$, 1000, 400], ... for this Google Area chart
And we assign hardcode value to string data. and
we split area Google chart in to two files one is
area1.html ,area2.html. And we print string data values using
PRINTLN(data).So when you use '2013' , this ' should be represent
as l$ ie) l$ is used instead of '. Because OJ7UA framework will
not accept special characters like ' , but it will accepts l$.
So when you compile using web7(Oj7) it will automatically genrates
.web file. This file is used for testing purpose.ie) We can find
the errors from .web file.So what does J7HTML.displayhtml
do ? Ans) It will print the file contents line by line
for eg)
<html>
<head>
....
There is no space in the code.so inorder
to print it line by line with a space
we use J7HTMl.displayhtml is used.
so the output for this code is
<html>
<head>
.....
.....
We must specify all this J7HTML,etc in one
method eg) display method ,because it give the readability
for the developers,customers,etc.Here in this
example you must define the display method in LOGIC section.
you must specify .exe for Type then only it generates the .exe
software to be used with webapplication. Here you must
call this display method in MAIN section which is given below...
MAIN=' display();?> '.
We must specify Names='ConsoleApp28,linegraph1' which is
package name and class name.Then only web7(Oj7) compiler will
not thow any error.You must use J7Html.dll in the
Web7(Oj7) properties file.Here the Output for this program is
given below...
Output
It will display the Area chart with OakJava7 Template and the Area chart is printed in the OakJava7 template. as given below....
BAR CHART
Barchart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='ConsoleApp28,Barcharts' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
g$J7ARRAYLIST> j7header = new g$J7ARRAYLIST>();
j7header.add(0,"l$Yearl$");
j7header.add(1,"l$Salesl$");
j7header.add(2,"l$Expensesl$");
j7header.add(3,"l$Profitl$");
g$J7ARRAYLIST> ar = new g$J7ARRAYLIST>();
ar.add(0,"l$2014l$");ar.add(1,1000);ar.add(2,400);ar.add(3,200);
g$J7ARRAYLIST> ar1 = new g$J7ARRAYLIST>();
ar1.add(0,"l$2015l$");ar1.add(1,1170);ar1.add(2,460);ar1.add(3,250);
g$J7ARRAYLIST> ar2 = new g$J7ARRAYLIST>();
ar2.add(0,"l$2016l$");ar2.add(1,660);ar2.add(2,1120);ar2.add(3,300);
g$J7ARRAYLIST> ar3 = new g$J7ARRAYLIST>();
ar3.add(0,"l$2017l$");ar3.add(1,1030);ar3.add(2,540);ar3.add(3,350);
g$J7ARRAYLIST> list = new g$J7ARRAYLIST>();
list.add(0,j7header);
list.add(1,ar);
list.add(2,ar1);list.add(3,ar2);list.add(4,ar3);
J7HTML.displayhtml("Barcharts1.html");
PRINTLN(" "+list);
J7HTML.displayhtml("Barcharts2.html");
} '>
</OakJava7>
</OJ7ML>
Explaination
When we go for Bar chart topic which is same as
Area chart. So for this Barchart explanation
refer Areachart explanation.But here in this example
Web(Oj7) arraylist <J7ARRAYLIST> is used.But when
you used in OJ7UA framework we should use g$ which
indicates '>. So when you compiler using Web(Oj7)
compiler it will be change to > in .web file.
In J7ARRAYLIST web(OJ7) , if you want to add the
value you must specify index and String/int
what ever may be. This index indicates the location
of the to be stored in a J7ArrayList. That index should
be in a sequence order. Example is given below...
g$J7ARRAYLIST> j7header = new g$J7ARRAYLIST>();
j7header.add(0,"l$Yearl$");
j7header.add(1,"l$Salesl$");
j7header.add(2,"l$Expensesl$");
j7header.add(3,"l$Profitl$");
Note : L$ means ' special character. And here you must
specify J7Html.dll in web7(OJ7) properties file.
Output for this Program is Given below.....
OUTPUT
COMBOCHART
combochart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{java7displayurl,format}' Names='Chart5,combochart1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string s=java7UrlConnectionReader.getUrlContents("http://localhost:8082/combolist.WS").Replace("g$HTML>","").Replace("g$/html>","");
J7HTML.displayhtml("combochart1.html");
PRINTLN(s);
J7HTML.displayhtml("combochart2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
As Explained in Area Chart is little bit same as
this combochart .oj7ua source code. But here instead of
hardcoding the values we use Web1.0 Programming Language
Webservice.We can get the contents of url using
java7UrlConnectionReader.getUrlContents (....) Method.
So this data is present in combolist url :
http://localhost:8082/combolist.WS. And next we are using .oj7ua
special symbols which is g$. Here in web7(Oj7) properties file
we are using java7UrlConnectionReader.dll file for the library J7lib
package java7displayurl.If you don't use this java7UrlConnectionReader.dll
in the properties file then web7(OJ7) compiler will throw an error. now we must remove the Html tags by replacing "g$html>" with empty string "". This can be achieved by using .Replace("g$/html>","") String method. The Output for this .oj7ua program is given below...
OUTPUT
COMBINATION CHART
Combinationchart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='ConsoleApp28,combinationcharts' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
g$J7ARRAYLIST> ar = new g$J7ARRAYLIST>();
ar.add(0,3);ar.add(1,1);ar.add(2,1);ar.add(3,1);
ar.add(4,2);
int a1=Convert.ToInt32(ar.get(0).ToString());
int a2=Convert.ToInt32(ar.get(1).ToString());
int a3=Convert.ToInt32(ar.get(2).ToString());
int a4=Convert.ToInt32(ar.get(3).ToString());
int a5=Convert.ToInt32(ar.get(4).ToString());
string data="
[l$Mushroomsl$, "+a1+" ],
[l$Onionsl$, "+ a2+"],
[l$Olivesl$,"+ a3+"],
[l$Zucchinil$,"+ a4+"],
[l$Pepperonil$,"+ a5+"]";
J7HTML.displayhtml("combinationchart1.html");
PRINTLN(data);
J7HTML.displayhtml("combinationchart2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
Here Combinationchart follows the Area chart here
we add the values to the <OJ7UTIL>.ArrayList.
We are using Convert.ToInt32 to convert String to
int format.After that we are hardcoding the value
and we use PRINTLN to print the data in the
webapplication. Here you should use <J7ARRAYLIST> type
ArrayList keyword , because <OJ7UTIL> is not a Good
one . I will teach the advantages of using <J7ARRAYLIST> Over <OJ7UTIL> package
later.
OUTPUT of this program is given below....
OUTPUT
Here we are displaying Pie chart and Bar chart .....
GantChart
Gantchart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{java7displayurl,format}' Names='Chart5,tablecharts' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string s=java7UrlConnectionReader.getUrlContents("http://localhost:8082/Gantchartlist.WS").Replace("g$HTML>","").Replace("g$/html>","");
J7HTML.displayhtml("Gantcharts1.html");
PRINTLN(s);
J7HTML.displayhtml("Gantcharts2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation:
Gantchart explanation is same as combo chart.But
we are using and displaying the google chart formats
Gantcharts1.html,Gantcharts2.html
OUTPUT
OUTPUT for this Gantchart is given below...
GEOCHART
Geochart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='ConsoleApp28,Geochart' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
g$J7ARRAYLIST> ar = new g$J7ARRAYLIST>();
ar.add(0,200);ar.add(1,300);ar.add(2,400);ar.add(3,500);
ar.add(4,600);ar.add(5,700); ar.add(6,800);
int a1=Convert.ToInt32(ar.get(0).ToString());
int a2=Convert.ToInt32(ar.get(1).ToString());
int a3=Convert.ToInt32(ar.get(2).ToString());
int a4=Convert.ToInt32(ar.get(3).ToString());
int a5=Convert.ToInt32(ar.get(4).ToString());
int a6=Convert.ToInt32(ar.get(5).ToString());
int a7=Convert.ToInt32(ar.get(6).ToString());
string data="
[l$Germanyl$, "+a1+" ],
[l$USAl$, "+ a2+"],
[l$Brazill$,"+ a3+"],
[l$Canadal$,"+ a4+"],
[l$Francel$,"+ a5+"],
[l$RUl$,"+ a6+"],
[l$Indial$,"+ a7+"]";
J7HTML.displayhtml("Geocharts1.html");
PRINTLN(data);
J7HTML.displayhtml("Geocharts2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
Explanation for this GeoChart is same as this combination chart.
OUTPUT
Here we add one more country that is India in Geochart. How it is happened ?
We must add values like [l$Indial$,"+ a7+"]" to string data...Like that you may add any
countries data to string data....
PIECHART
Piechart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{format}' Names='ConsoleApp28,piecharts' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
g$J7ARRAYLIST> ar = new g$J7ARRAYLIST>();
ar.add(0,1);ar.add(1,2);ar.add(2,2);ar.add(3,2);
ar.add(4,7);
int a1=Convert.ToInt32(ar.get(0).ToString());
int a2=Convert.ToInt32(ar.get(1).ToString());
int a3=Convert.ToInt32(ar.get(2).ToString());
int a4=Convert.ToInt32(ar.get(3).ToString());
int a5=Convert.ToInt32(ar.get(4).ToString());
string data="[l$Taskl$, l$Hours per Dayl$],
[l$Workl$, "+a1+" ],
[l$Eatl$, "+ a2+"],
[l$Commutel$,"+ a3+"],
[l$WatchTVl$,"+ a4+"],
[l$Sleepl$,"+ a5+"]";
J7HTML.displayhtml("piechart1.html");
PRINTLN(data);
J7HTML.displayhtml("piechart2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
Explanation for this pie chart is same as this combination chart.
OUTPUT
Output for the piechart with Daily Activites is given below....
TABLECHART
Tablechart.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{java7displayurl,format}' Names='Chart5,tablecharts' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string s=java7UrlConnectionReader.getUrlContents("http://localhost:8082/tblelist.WS").Replace("g$HTML>","").Replace("g$/html>","");
J7HTML.displayhtml("Tablecharts1.html");
PRINTLN(s);
J7HTML.displayhtml("Tablecharts2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
Explanation for Tablechart is same as combochart.
Here i have added attractive Zebra Stribes.
The Output for the Zebra Stribes is given below...
OUTPUT
The Table chart With Zebra Styles and Attractive Styles is given below...
TREECHART
WordTrees1.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='DataScience' Database='wnosql' J7Lib='{java7displayurl,format}' Names='ConsoleApp28,WordTrees1' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
string list=java7UrlConnectionReader.getUrlContents("http://localhost:8082/trees.WS").Replace("g$HTML>","").Replace("g$/html>","");
J7HTML.displayhtml("WordTrees1.html");
PRINTLN(" "+list);
J7HTML.displayhtml("WordTrees2.html");
} '>
</OakJava7>
</OJ7ML>
Explanation
Explanation for TreeChart is same as combochart.
Here i have added attractive green colour with Google-> TreeChart.
OUTPUT
Output for the TreeChart with colour green on Google->treechart
is given below....
===============================================================================
Section 2: Topic-2 about Mean, Variance, and Standard Deviation
===============================================================================
What is Mean ?
The mean (average) of a data set is found by adding all numbers in the data set and then dividing by the number of values in the set.
What is Variance ?
The Variance is a statistical measure that describes how much the values in a dataset deviate from the mean (average).
What is Standard Deviation ?
Standard deviation is a measure of how spread out a set of data is around its average (mean). In simple terms, it tells you, on average, how far each data point is from the mean. A low standard deviation indicates that the data points are clustered tightly around the mean, while a high standard deviation means they are more spread out.
stdexample.oj7ua
<OJ7ML>
<DESIGN SRC=' '> </DESIGN>
<OakJava7 Package='ML' Database='wnosql' J7Lib='{Datascience}' Names='SDpack,statics' Type='exe' MAIN=' display();?> '
LOGIC=' public static void display() {
g$OJ7UTIL>.ArrayList ar g$NEW> g$OJ7UTIL>.ArrayList();
ar.add(46);ar.add( 69);ar.add( 32);ar.add( 60); ar.add( 52); ar.add( 41);
Datascience.Excels.call(ar, "stddemo.xls", "ex1", 0, 1);
string ar1=Datascience.Excels.call(ar, "stddemo.xls", "ex1", 0, 2).Replace("[","").Replace("]","");
string [] a= ar1.Split(l$,l$);
double d2=Statistics.J7DataScience.Mean(a);
g$J7ARRAYLIST> ans=Statistics.J7DataScience.STD(a,d2);
PRINTLN(ans);
}
'>
</OakJava7>
</OJ7ML>
Explanation:
Here we add datas [46,69,32,60,52,41] to the ArrayList
and after that write to excel sheet using the method Datascience.Excels.call
and pass arraylist as a parameter and Assign to a string ar1.
and After that use ar1.Split(l$,l$) to split the data by ",".
and after that assign to string array a.
and after that pass string array to the method Statistics.J7DataScience.Mean(a)
for calculating the Mean and asssign to the variable double d2.
And after that pass the array a and d2 (the Mean) to the method
Statistics.J7DataScience.STD(a,d2) and it's result is passed
to the <J7ARRAYLIST> util package and it is printed
on the console.
Note: Here use Excels.dll,J7Statistics.web.dll in the WEB7.0(OJ7) Properties.txt file.
OutPut of this Web7.0(OJ7) program will be in Array List format which is given below...
Output
[50, 177.2, 13.311649033835]
Note: Here 50 indicates Mean , 177.2 indicates variance,
and 13.311649033835 indicates Standard Deviation(SD)
====================================================
ADVANTAGES
Advantages of Web7(OJ7) is this Data Science Tutorial is very interesting , very useful , easy to use. and It reduce cost and time to develop a Data science with Google Charts using OJ7UA Framework.
======================================================================
Note: If you want more about Google charts with OJ7UA framework will be included in WEB7(OJ7) Enterprise Edition. So Google chart is more important for Web7(OJ7) Programming..
This is the End of 2nd Section for WEB7.0(OJ7) Programming Language. You can see 3rd Section in WEB7.0(OJ7) Programming Language in WEB7(OJ7) Enterprise Edition.
Learn it and Enjoy it and after i release Web7(Oj7) and Scroll server Practice it.
Now you read this Datascience Tutorial.
==============================================================================
END OF WEB7(OJ7) Datascience Tutorial Professional Edition.
===============================================================================