28 August 2014

chart.js

In here show how to use chart.js, Chart js is open source chart platform for web based applications.So it is very easy to use chart.js in your web site.First you have to download (https://github.com/nnnick/Chart.js) chart.js and chart.min.js files.Then in your html file you can add this code for bar chart.

Bar chart





<script>
var barChartData = {
labels : ["Sunday","Mondey","Tuesday","Wednesday","Thursday","Friday","Saturday"],
datasets : [
{
fillColor : "rgba(220,220,220,0.5)",
strokeColor : "rgba(220,220,220,0.8)",
highlightFill: "rgba(220,220,220,0.75)",
highlightStroke: "rgba(220,220,220,1)",
data : [85,65,35,55,80,20,90]
},
{
fillColor : "rgba(151,187,205,0.5)",
strokeColor : "rgba(151,187,205,0.8)",
highlightFill : "rgba(151,187,205,0.75)",
highlightStroke : "rgba(151,187,205,1)",
data : [55,100,30,70,30,65,45]
}
]
}
window.onload = function(){
var ctx = document.getElementById("canvas").getContext("2d");
window.myBar = new Chart(ctx).Bar(barChartData, {
responsive : true
});
}
</script>


Then inside canvas you can draw the bar chart.


<div style="width: 50%">
   <canvas id="canvas" height="450" width="600"></canvas>
</div>
Inside the Script you can change colors of charts.

Pie chart



<script>

  var pieData = [

    {

     value: 300,

     color:"#F7464A",

     highlight: "#FF5A5E",

     label: "Food"

    },

    {

     value: 50,

     color: "#46BFBD",

     highlight: "#5AD3D1",

     label: "Transport"

    },

    {

     value: 100,

     color: "#FDB45C",

     highlight: "#FFC870",

     label: "Drinks"

    },

    {

     value: 40,

     color: "#949FB1",

     highlight: "#A8B3C5",

     label: "class"

    },

    {

     value: 120,

     color: "#4D5360",

     highlight: "#616774",

     label: "Others"

    }



   ];



   window.onload = function(){

    var ctx = document.getElementById("chart-area").getContext("2d");

    window.myPie = new Chart(ctx).Pie(pieData);

   };



 </script>

22 August 2014

Install juju in local lxc contanier

Install JUJU in ubuntu

In this thread i have described how to install juju in ubuntu 14.04.First You have to install juju in to your machine.
   
   sudo apt-add-repository ppa:juju/stable
   sudo apt-get update
And then install juju-core in to your machine.It might takes more times based on your internet connection.
sudo apt-get install juju-local
Then for the configuration 
juju generate-config
juju switch local
Then You need to bootstrap the local environment.So Then enter this command
juju bootstrap --show-log
This might be take more than 20 minutes it is based on your internet connection.After installing juju you can check the status of the juju environment.
juju status
Then for the Testing you can install juju GUI.This will help you to understand what charm is running and what are the relationships using graphical view.
juju deploy juju-gui
juju expose juju-gui

How to create juju charm

First you have to install juju and then you have install charm tools for juju.
sudo add-apt-repository ppa:juju/stable
sudo apt-get update;
sudo apt-get install charm-tools;