forked from lcallarec/live-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
265 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Cairo; | ||
|
||
namespace LiveChart { | ||
public class Area : Drawable, Object { | ||
private Points points; | ||
private BoundingBox bounding_box = BoundingBox() { | ||
x=0, | ||
y=0, | ||
width=0, | ||
height=0 | ||
}; | ||
private double alpha = 0.3; | ||
public Gdk.RGBA main_color { | ||
get; set; default = Gdk.RGBA() { | ||
red = 1.0, | ||
green = 1.0, | ||
blue = 1.0, | ||
alpha = 0.5 | ||
}; | ||
} | ||
|
||
public Area(Points points, Gdk.RGBA main_color, double alpha) { | ||
this.points = points; | ||
this.main_color = main_color; | ||
this.alpha = alpha; | ||
} | ||
|
||
public void draw(Context ctx, Config config) { | ||
var boundaries = config.boundaries(); | ||
var first_point = points.first(); | ||
var last_point = points.last(); | ||
|
||
ctx.set_source_rgba(this.main_color.red, this.main_color.green, this.main_color.blue, alpha); | ||
ctx.line_to(last_point.x, last_point.y); | ||
ctx.line_to(last_point.x, boundaries.y.max); | ||
ctx.line_to(first_point.x, boundaries.y.max); | ||
ctx.line_to(first_point.x, first_point.y); | ||
ctx.close_path(); | ||
ctx.fill_preserve(); | ||
} | ||
public BoundingBox get_bounding_box() { | ||
return bounding_box; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Cairo; | ||
|
||
namespace LiveChart { | ||
public class LineArea : Line { | ||
|
||
public double area_alpha {get; set; default = 0.1;} | ||
|
||
public LineArea(Values values = new Values()) { | ||
base(values); | ||
} | ||
|
||
public override void draw(Context ctx, Config config) { | ||
var points = Points.create(values, config); | ||
|
||
this.draw_line(points, ctx, config); | ||
ctx.stroke_preserve(); | ||
|
||
var area = new Area(points, this.main_color, this.area_alpha); | ||
area.draw(ctx, config); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Cairo; | ||
|
||
namespace LiveChart { | ||
public class SmoothLineArea : SmoothLine { | ||
|
||
public double area_alpha {get; set; default = 0.1;} | ||
|
||
public override void draw(Context ctx, Config config) { | ||
var points = Points.create(values, config); | ||
|
||
this.draw_smooth_line(points, ctx, config); | ||
ctx.stroke_preserve(); | ||
|
||
var area = new Area(points, this.main_color, this.area_alpha); | ||
area.draw(ctx, config); | ||
} | ||
} | ||
} |
Oops, something went wrong.