Font

Generic Font object
Class: Cosfire.Font()


Code using Axis Class
                                     var chart = new Cosfire.Chart("chart-div",{width:700,
                                            height:250}); 
                                          
 /* Create instance of Font */
 titles :[{text: 'Chart Title1', 
           fontWeight: 'bolder'}, 
          {text: 'Chart Title2', 
           fontSize:18, 
           fontColor: '#d10a14'}];
 data: [{ 
         plotAs: 'stackedColumn',
         points: [
                 {xLabel: "January", y: 50},
                 {xLabel: "February", y: 60},
                 {xLabel: "March", y: 75},
                 {xLabel: "April", y: 40},
                 {xLabel: "May", y: 70},
                 {xLabel: "June", y: 45},
                 {xLabel: "July", y: 30},
                 {xLabel: "August", y: 80}
                 ]
        },
        {plotAs: 'stackedColumn',
         points: [
                 {xLabel: "January", y: 120},
                 {xLabel: "February", y: 100},
                 {xLabel: "March", y: 150},
                 {xLabel: "April", y: 170},
                 {xLabel: "May", y: 90},
                 {xLabel: "June", y: 70},
                 {xLabel: "July", y: 140},
                 {xLabel: "August", y: 110}
                 ]
        }
 ];

 /* Add the font to chart */
chart.setData(data);    
chart.render();
                                
Using JSON Approach
                                     var chartJSON = { 
     width: 700,
     height: 250, 
     titles: [{ text: 'Chart Title1', 
                fontWeight: 'bolder' }, 
              { text: 'Chart Title2', 
                fontSize: 18, 
                fontColor: '#d10a14' 
             }],
     data: [{ plotAs: 'stackedColumn',
              points: [{ xLabel: "January", y: 50 },
                       { xLabel: "February", y: 60 },
                       { xLabel: "March", y: 75 },
                       { xLabel: "April", y: 40 },
                       { xLabel: "May", y: 70 },
                       { xLabel: "June", y: 45 },
                       { xLabel: "July", y: 30 },
                       { xLabel: "August", y: 80 }]
            },
            { plotAs: 'stackedColumn',
              points: [{ xLabel: "January", y: 120 },
                       { xLabel: "February", y: 100 },
                       { xLabel: "March", y: 150 },
                       { xLabel: "April", y: 170 },
                       { xLabel: "May", y: 90 },
                       { xLabel: "June", y: 70 },
                       { xLabel: "July", y: 140 },
                       { xLabel: "August", y: 110 }]
            }]
    };
 
 chart = new Cosfire.Chart("chart-div", chartJSON);
 chart.render();

                                  
                                 

                                  
                                 
                                

Properties supported under Font object.


Size Of The Font In Pixel
Property Type Default Possible Values Description
fontSize Number Not set Number > 0 Size of the font in pixel.
fontcolor String Not set The fontcolor property is used to set the color of the text. The color is specified by:
  • a color name - like "red"
  • a HEX value - like "#ff0000"
  • an RGB value - like "rgb(255,0,0)"
---
fontFamily String Arial --- Any browser supported font family or installed google font.
fontStyle String normal
  • normal
  • italic
  • oblique
---
fontWeight String normal
  • normal
  • bold
  • bolder
  • lighter
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
---