Last change
on this file since 3199 was
1530,
checked in by gkronber, 16 years ago
|
Moved source files of plugins Hive ... Visualization.Test into version-specific sub-folders. #576
|
File size:
765 bytes
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Visualization {
|
---|
5 | public static class AxisTicks {
|
---|
6 | public static IEnumerable<double> GetTicks(int pixelsPerInterval, int screenSize, double worldSize, double worldStart) {
|
---|
7 | int intervals = screenSize/pixelsPerInterval;
|
---|
8 |
|
---|
9 | if (intervals > 0) {
|
---|
10 | double step = worldSize/intervals;
|
---|
11 | step = Math.Pow(10, Math.Floor(Math.Log10(step)));
|
---|
12 | if (worldSize/(step*5) > intervals)
|
---|
13 | step = step*5;
|
---|
14 | else if (worldSize/(step*2) > intervals)
|
---|
15 | step = step*2;
|
---|
16 |
|
---|
17 | for (double x = Math.Floor(worldStart/step)*step;
|
---|
18 | x <= worldStart + worldSize;
|
---|
19 | x += step)
|
---|
20 | yield return x;
|
---|
21 | }
|
---|
22 | }
|
---|
23 | }
|
---|
24 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.