Options: Difference between revisions

From JSXGraph Wiki
(New page: Below are the default values for many parameters of a SJXGraph construction. These values have to be overwritten before the initialization of the JSXGraph board via <source lang="javascript"> J...)
 
No edit summary
 
(18 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Below are the default values for many parameters of a SJXGraph construction. These values have to be overwritten before the initialization of the JSXGraph board via
Below are the default values for many parameters of a JSXGraph construction. These values have to be overwritten before the initialization of the JSXGraph board via
<source lang="javascript">
<source lang="javascript">
    JXG.Options.text.useASCIIMathML = true;
JXG.Options.text.fontSize = 14;
JXG.Options.text.useASCIIMathML = true;
</source>
</source>
or more compact


<source lang="javascript">
<source lang="javascript">
JXG.Options = {
JXG.Options = JXG.merge(JXG.Options, {
    /* Options that are used directly within the board class */
     showNavigation: false,
    fontSize : 12,
     point: {
    showCopyright : true,
         face: 'x'
    showNavigation : true,
     }
    takeSizeFromFile : true, // If true, the construction - when read from a file or string - the size of the div can be changed.
  });
 
</source>
    /* grid options */
    grid : {
        /* grid styles */
        hasGrid : false,
        gridX : 2,
        gridY : 2,
        gridColor : '#C0C0C0',
        gridOpacity : '0.5',
        gridDash : true,
        /* snap to grid options */
        snapToGrid : false,
        snapSizeX : 2,
        snapSizeY : 2
    },
    /* zoom options */
    zoom : {
        factor : 1.25
     },
 
    /* geometry element options */
    elements : {
        /* color options */
        color : {
            strokeOpacity : 1,
            highlightStrokeOpacity : 1,
            fillOpacity : 1,
            highlightFillOpacity : 1,
 
            strokeColor : '#0000ff',
            highlightStrokeColor : '#C3D9FF',
            fillColor : 'none',
            highlightFillColor : 'none'
        },
        strokeWidth : '2px',
 
        /*draft options */
        draft : {
            draft : false,
            color : '#565656',
            opacity : 0.8,
            strokeWidth : '1px'
        }
    },
      
    /* special point options */
    point : {
        style : 5, //1;
        fillColor : '#ff0000',
        highlightFillColor : '#EEEEEE',
        strokeColor : '#0000ff',       
        highlightStrokeColor : '#C3D9FF'
    },
 
    /* special line options */
    line : {   
        firstArrow : false,
        lastArrow : false,
        straightFirst : true,
        straightLast : true,
        fillColor : '#000000',           
        highlightFillColor : 'none',     
        strokeColor : '#0000ff',         
        highlightStrokeColor : '#888888',
        /* line ticks options */
        ticks : {
            drawLabels : true,
            drawZero : false,
            insertTicks : false,
            minTicksDistance : 50,
            maxTicksDistance : 300,
            minorHeight : 4,
            majorHeight : 10,
            minorTicks : 4,
            defaultDistance : 1
        }
    },
   
    /*special circle options */
    circle : {
        fillColor : 'none',             
        highlightFillColor : 'none',   
        strokeColor : '#0000ff',       
        highlightStrokeColor : '#C3D9FF'
    },
 
    /* special angle options */
    angle : {
         radius : 1.0,
        fillColor : '#FF7F00',
        highlightFillColor : '#FF7F00',
        strokeColor : '#FF7F00',
        fillOpacity : 0.3,
        highlightFillOpacity : 0.3
     },
 
    /* special arc options */
    arc : {
        firstArrow : false,
        lastArrow : false,
        fillColor : 'none',             
        highlightFillColor : 'none',     
        strokeColor : '#0000ff',         
        highlightStrokeColor : '#C3D9FF'  
    },
   
    /* special polygon options */
    polygon : {
        fillColor : '#00FF00',
        highlightFillColor : '#00FF00',
        fillOpacity : 0.3,
        highlightFillOpacity : 0.3
    },
   
    /* special sector options */
    sector : {
        fillColor : '#00FF00',
        highlightFillColor : '#00FF00',
        fillOpacity : 0.3,
        highlightFillOpacity : 0.3
    },
   
    /* special text options */
    text : {
        strokeColor : '#000000',
        useASCIIMathML : false,
        defaultType : 'html' //'html' or 'internal'
    },


    /* special curve options */
If you have some more options you want to use for more than just one construction you can save them in an extra .js file and include them right after loading JSXGraph.
    curve : {
        strokeWidth : '1px',
        strokeColor : '#0000ff',
        RDPsmoothing : false,    // Apply the Ramen-Douglas-Peuker algorithm
        numberPointsHigh : 1600, // Number of points on curves after mouseUp
        numberPointsLow : 400,  // Number of points on curves after mousemove
        doAdvancedPlot : true    // Use the algorithm by Gillam and Hohenwarter
                                // It is much slower, but the result is better
    },
   
    /* precision options */
    precision : {
        hasPoint : 4,
        epsilon : 0.0001
    }
};


</source>
The complete list of default can be seen in the latest version of Options.js which available at
[https://github.com/jsxgraph/jsxgraph/blob/master/src/options.js].

Latest revision as of 11:50, 19 May 2014

Below are the default values for many parameters of a JSXGraph construction. These values have to be overwritten before the initialization of the JSXGraph board via

JXG.Options.text.fontSize = 14;
JXG.Options.text.useASCIIMathML = true;

or more compact

JXG.Options = JXG.merge(JXG.Options, {
    showNavigation: false,
    point: {
        face: 'x'
    }
 });

If you have some more options you want to use for more than just one construction you can save them in an extra .js file and include them right after loading JSXGraph.

The complete list of default can be seen in the latest version of Options.js which available at [1].