Browse Source

Fixed #1615: implemented new option `dotSizeRatio`

codeClimate
jos 8 years ago
parent
commit
cd3bb8a5a9
3 changed files with 16 additions and 2 deletions
  1. +3
    -0
      HISTORY.md
  2. +7
    -0
      docs/graph3d/index.html
  3. +6
    -2
      lib/graph3d/Graph3d.js

+ 3
- 0
HISTORY.md View File

@ -4,6 +4,9 @@ http://visjs.org
## not yet released, version 4.13.1-SNAPSHOT
### Graph3d
- Fixed #1615: implemented new option `dotSizeRatio`.
## 2016-02-01, version 4.13.0

+ 7
- 0
docs/graph3d/index.html View File

@ -379,6 +379,13 @@ var options = {
<td>The line width of dots, bars and lines. Applicable for all styles.</td>
</tr>
<tr>
<td>dotSizeRatio</td>
<td>number</td>
<td>0.02</td>
<td>Ratio of the size of the dots with respect to the width of the graph.</td>
</tr>
<tr>
<td>gridColor</td>
<td>string</td>

+ 6
- 2
lib/graph3d/Graph3d.js View File

@ -96,6 +96,8 @@ function Graph3d(container, data, options) {
strokeWidth: 1 // px
};
this.dotSizeRatio = 0.02; // size of the dots as a fraction of the graph width
// create a frame and canvas
this.create();
@ -844,6 +846,8 @@ Graph3d.prototype.setOptions = function (options) {
if (options.yValueLabel !== undefined) this.yValueLabel = options.yValueLabel;
if (options.zValueLabel !== undefined) this.zValueLabel = options.zValueLabel;
if (options.dotSizeRatio !== undefined) this.dotSizeRatio = options.dotSizeRatio;
if (options.style !== undefined) {
var styleNumber = this._getStyleNumber(options.style);
if (styleNumber !== -1) {
@ -976,7 +980,7 @@ Graph3d.prototype._redrawLegend = function() {
if (this.style === Graph3d.STYLE.DOTCOLOR ||
this.style === Graph3d.STYLE.DOTSIZE) {
var dotSize = this.frame.clientWidth * 0.02;
var dotSize = this.frame.clientWidth * this.dotSizeRatio;
var widthMin, widthMax;
if (this.style === Graph3d.STYLE.DOTSIZE) {
@ -1613,7 +1617,7 @@ Graph3d.prototype._redrawDataDot = function() {
this.dataPoints.sort(sortDepth);
// draw the datapoints as colored circles
var dotSize = this.frame.clientWidth * 0.02; // px
var dotSize = this.frame.clientWidth * this.dotSizeRatio; // px
for (i = 0; i < this.dataPoints.length; i++) {
var point = this.dataPoints[i];

Loading…
Cancel
Save