mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 23:51:06 +00:00
libsysprof-gtk: get Axis working
This commit is contained in:
@ -15,6 +15,7 @@ libsysprof_gtk_public_sources = [
|
|||||||
'sysprof-time-span-layer.c',
|
'sysprof-time-span-layer.c',
|
||||||
'sysprof-time-series.c',
|
'sysprof-time-series.c',
|
||||||
'sysprof-time-series-item.c',
|
'sysprof-time-series-item.c',
|
||||||
|
'sysprof-value-axis.c',
|
||||||
'sysprof-weighted-callgraph-view.c',
|
'sysprof-weighted-callgraph-view.c',
|
||||||
'sysprof-xy-layer.c',
|
'sysprof-xy-layer.c',
|
||||||
'sysprof-xy-series.c',
|
'sysprof-xy-series.c',
|
||||||
@ -41,6 +42,7 @@ libsysprof_gtk_public_headers = [
|
|||||||
'sysprof-time-series-item.h',
|
'sysprof-time-series-item.h',
|
||||||
'sysprof-time-span-layer.h',
|
'sysprof-time-span-layer.h',
|
||||||
'sysprof-weighted-callgraph-view.h',
|
'sysprof-weighted-callgraph-view.h',
|
||||||
|
'sysprof-value-axis.h',
|
||||||
'sysprof-xy-layer.h',
|
'sysprof-xy-layer.h',
|
||||||
'sysprof-xy-series.h',
|
'sysprof-xy-series.h',
|
||||||
'sysprof-xy-series-item.h',
|
'sysprof-xy-series-item.h',
|
||||||
|
|||||||
@ -152,7 +152,7 @@ sysprof_axis_set_title (SysprofAxis *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_charts_axis_emit_range_changed (SysprofAxis *self)
|
_sysprof_axis_emit_range_changed (SysprofAxis *self)
|
||||||
{
|
{
|
||||||
g_return_if_fail (SYSPROF_IS_AXIS (self));
|
g_return_if_fail (SYSPROF_IS_AXIS (self));
|
||||||
|
|
||||||
|
|||||||
@ -20,8 +20,24 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "sysprof-axis-private.h"
|
||||||
#include "sysprof-value-axis.h"
|
#include "sysprof-value-axis.h"
|
||||||
|
|
||||||
|
struct _SysprofValueAxis
|
||||||
|
{
|
||||||
|
SysprofAxis parent_instance;
|
||||||
|
double min_value;
|
||||||
|
double max_value;
|
||||||
|
double distance;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _SysprofValueAxisClass
|
||||||
|
{
|
||||||
|
SysprofAxisClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_MIN_VALUE,
|
PROP_MIN_VALUE,
|
||||||
@ -79,8 +95,8 @@ sysprof_value_axis_real_get_min_value (SysprofAxis *axis,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static double
|
static double
|
||||||
sysprof_value_axis_normalize (SysprofAxis *axis,
|
sysprof_value_axis_normalize (SysprofAxis *axis,
|
||||||
const GValue *value)
|
const GValue *value)
|
||||||
{
|
{
|
||||||
SysprofValueAxis *self = (SysprofValueAxis *)axis;
|
SysprofValueAxis *self = (SysprofValueAxis *)axis;
|
||||||
double v = get_as_double (value);
|
double v = get_as_double (value);
|
||||||
@ -91,9 +107,9 @@ sysprof_value_axis_normalize (SysprofAxis *axis,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_value_axis_get_property (GObject *object,
|
sysprof_value_axis_get_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
SysprofValueAxis *self = SYSPROF_VALUE_AXIS (object);
|
SysprofValueAxis *self = SYSPROF_VALUE_AXIS (object);
|
||||||
|
|
||||||
@ -114,9 +130,9 @@ sysprof_value_axis_get_property (GObject *object,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_value_axis_set_property (GObject *object,
|
sysprof_value_axis_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
SysprofValueAxis *self = SYSPROF_VALUE_AXIS (object);
|
SysprofValueAxis *self = SYSPROF_VALUE_AXIS (object);
|
||||||
|
|
||||||
@ -175,7 +191,7 @@ sysprof_value_axis_get_min_value (SysprofValueAxis *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
sysprof_value_axis_set_min_value (SysprofValueAxis *self,
|
sysprof_value_axis_set_min_value (SysprofValueAxis *self,
|
||||||
double min_value)
|
double min_value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (SYSPROF_IS_VALUE_AXIS (self));
|
g_return_if_fail (SYSPROF_IS_VALUE_AXIS (self));
|
||||||
|
|
||||||
@ -198,7 +214,7 @@ sysprof_value_axis_get_max_value (SysprofValueAxis *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
sysprof_value_axis_set_max_value (SysprofValueAxis *self,
|
sysprof_value_axis_set_max_value (SysprofValueAxis *self,
|
||||||
double max_value)
|
double max_value)
|
||||||
{
|
{
|
||||||
g_return_if_fail (SYSPROF_IS_VALUE_AXIS (self));
|
g_return_if_fail (SYSPROF_IS_VALUE_AXIS (self));
|
||||||
|
|
||||||
@ -210,3 +226,13 @@ sysprof_value_axis_set_max_value (SysprofValueAxis *self,
|
|||||||
_sysprof_axis_emit_range_changed (SYSPROF_AXIS (self));
|
_sysprof_axis_emit_range_changed (SYSPROF_AXIS (self));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SysprofAxis *
|
||||||
|
sysprof_value_axis_new (double min_value,
|
||||||
|
double max_value)
|
||||||
|
{
|
||||||
|
return g_object_new (SYSPROF_TYPE_VALUE_AXIS,
|
||||||
|
"min-value", min_value,
|
||||||
|
"max-value", max_value,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|||||||
@ -24,10 +24,10 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define SYSPROF_TYPE_VALUE_AXIS (sysprof_value_axis_get_type())
|
#define SYSPROF_TYPE_VALUE_AXIS (sysprof_value_axis_get_type())
|
||||||
#define SYSPROF_IS_AXIS(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, SYSPROF_TYPE_AXIS))
|
#define SYSPROF_IS_VALUE_AXIS(obj) (G_TYPE_CHECK_INSTANCE_TYPE(obj, SYSPROF_TYPE_VALUE_AXIS))
|
||||||
#define SYSPROF_AXIS(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, SYSPROF_TYPE_AXIS, SysprofValueAxis))
|
#define SYSPROF_VALUE_AXIS(obj) (G_TYPE_CHECK_INSTANCE_CAST(obj, SYSPROF_TYPE_VALUE_AXIS, SysprofValueAxis))
|
||||||
#define SYSPROF_AXIS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST(klass, SYSPROF_TYPE_AXIS, SysprofValueAxisClass))
|
#define SYSPROF_VALUE_AXIS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST(klass, SYSPROF_TYPE_VALUE_AXIS, SysprofValueAxisClass))
|
||||||
|
|
||||||
typedef struct _SysprofValueAxis SysprofValueAxis;
|
typedef struct _SysprofValueAxis SysprofValueAxis;
|
||||||
typedef struct _SysprofValueAxisClass SysprofValueAxisClass;
|
typedef struct _SysprofValueAxisClass SysprofValueAxisClass;
|
||||||
|
|||||||
Reference in New Issue
Block a user