mortgage calculator using area spline chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

mortgage calculator using area spline chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="width: 600px; height: 400px; margin: 0 auto"></div> 
      <script type="text/javascript">
Highcharts.chart('container', {
  chart: {//  w ww .  jav a  2  s  .c o  m
    type: 'areaspline',
    spacingTop: 40
  },
  title: {
    text: ''
  },
  subtitle: {
    text: 'The chart below represents your payments and how they are allocated throught the duration of the loan.',
    align: 'left',
    y: -20
  },
  credits: {
    enabled: false
  },
  legend: {
    align: 'left',
    verticalAlign: 'top',
    floating: true,
    y: 15,
    itemStyle: {
      fontWeight: 'normal'
    }
  },
  xAxis: {
    type: 'datetime',
    minPadding: 0,
    maxPadding: 0
  },
  yAxis: {
    opposite: true,
    title: {
      text: ''
    },
    labels: {
      formatter: function() {
        return '$' + Highcharts.numberFormat(this.value, 0, '.', ',');
      }
    }
  },
  plotOptions: {
    series: {
      marker: {
        enabled: false
      }
    }
  },
  series: [{
    name: 'Balance',
    color: '#67B6EB',
    data: [{
      x: Date.UTC(2017, 09, 01),
      y: 300000
    }, {
      x: Date.UTC(2030, 02, 30),
      y: 200000
    }, {
      x: Date.UTC(2045, 02, 30),
      y: 0
    }]
  }, {
    name: 'Interest',
    color: '#9DF5A0',
    data: [{
      x: Date.UTC(2017, 09, 01),
      y: 0
    }, {
      x: Date.UTC(2030, 02, 30),
      y: 120000
    }, {
      x: Date.UTC(2045, 02, 30),
      y: 200000
    }]
  }, {
    name: 'Principal',
    color: '#C9C7C7',
    data: [{
      x: Date.UTC(2017, 09, 01),
      y: 0
    }, {
      x: Date.UTC(2033, 02, 30),
      y: 120000
    }, {
      x: Date.UTC(2045, 02, 30),
      y: 300000
    }]
  }]
});

      </script>  
   </body>
</html>

Related Tutorials