Commit 3fcabff6 authored by Frank Bergmann's avatar Frank Bergmann

Initial Import

parents
Pipeline #628 failed with stages
<if "" ne @data_list@>
<div id=@diagram_id@></div>
<script type='text/javascript'>
Ext.require(['Ext.chart.*', 'Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
window.store = Ext.create('Ext.data.JsonStore', {
fields: @fields_json;noquote@,
data: @data_json;noquote@
});
Ext.onReady(function () {
chart = new Ext.chart.Chart({
width: 600,
height: 400,
animate: false,
store: store,
renderTo: '@diagram_id@',
legend: { position: 'right' },
axes: [{
type: 'Numeric',
position: 'left',
fields: [@fields_joined;noquote@],
minimum: 0,
maximum: 400
}, {
type: 'Time',
position: 'bottom',
fields: 'date',
dateFormat: 'M Y',
constrain: false,
step: [Ext.Date.MONTH, 2],
fromDate: @audit_start_date_js;noquote@,
toDate: @audit_end_date_js;noquote@
}],
series: [{
type: 'line',
axis: ['left','bottom'],
xField: 'date',
yField: 'm18232',
markerConfig: { radius: 5, size: 5 }
}]
}
)});
</script>
</if>
# /packages/sencha-reporting-portfolio/lib/milestone-tracker.tcl
#
# Copyright (C) 2012 ]project-open[
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
# ----------------------------------------------------------------------
#
# ---------------------------------------------------------------------
# The following variables are expected in the environment
# defined by the calling /tcl/*.tcl libary:
# project_id
# diagram_title
# diagram_width
# diagram_height
if {![info exists diagram_width]} { set diagram_width 300 }
if {![info exists diagram_height]} { set diagram_height 300 }
set year 2000
set month "01"
set day "01"
# project_id may be overwritten by SQLs below
set org_project_id $project_id
# Create a random ID for the diagram
set diagram_rand [expr round(rand() * 100000000.0)]
set diagram_id "milestone_tracker_$diagram_rand"
# Check if there is at least one correctly defined
# milestone in the project.
set milestone_count [db_string milestone_count "
select count(*)
from im_projects parent,
im_projects child
where parent.project_id = :org_project_id and
child.parent_id = parent.project_id and
(child.milestone_p = 't'
OR child.project_type_id in ([join [im_sub_categories [im_project_type_milestone]] ","]))
"]
if {$milestone_count} {
set milestone_sql "and (child.milestone_p = 't' OR child.project_type_id in ([join [im_sub_categories [im_project_type_milestone]] ","]))"
} else {
# There are no milestones defined, so just
# just show all sub-projects
set milestone_sql "and child.project_type_id not in ([im_project_type_ticket], [im_project_type_task])"
}
# Pull out the history of the project's milestones over time.
# Start to pull out the different days for which audit info
# is available and build the medium of the respective start-
# and end dates.
set base_sql "
select audit.*,
last_modified::date as audit_date
from im_projects parent,
im_projects child,
im_projects_audit audit
where parent.project_id = $org_project_id and
child.parent_id = parent.project_id
$milestone_sql and
audit.project_id = child.project_id
"
# Get the list of available milestones
set milestone_ids_sql "
select distinct
project_id
from ($base_sql) b
where end_date is not null
"
set milestone_ids [db_list milestone_ids $milestone_ids_sql]
# Get the list of distinct dates when changes have ocurred
set date_sql "
select distinct
audit_date
from ($base_sql) d
where end_date is not null
order by audit_date
"
set audit_dates [db_list audit_dates $date_sql]
# Calculate start and end date for X axis and
# format the start and end date for JavaScript
db_1row start_end "
select min(audit_date) as audit_start_date,
max(audit_date) as audit_end_date
from ($date_sql) t
"
# ad_return_complaint 1 "$audit_start_date - $audit_end_date"
regexp {^(....)\-(..)\-(..)$} $audit_start_date match year month day
set audit_start_date_js "new Date($year, $month, $day)"
regexp {^(....)\-(..)\-(..)$} $audit_end_date match year month day
set audit_end_date_js "new Date($year, $month, $day)"
# Select out the project start as base for the Y axis
set reference_start_julian [db_string ref_julian "select to_char(start_date, 'J') from im_projects where project_id = :org_project_id"]
# Get the average end_date for each of the days for each of the milestones
set changes_sql "
select b.project_id,
b.audit_date,
round(avg(to_char(b.end_date, 'J')::float)) as end_julian
from ($date_sql) d
LEFT OUTER JOIN ($base_sql) b ON (d.audit_date = b.audit_date)
group by b.project_id, b.audit_date
order by b.audit_date, b.project_id
"
# Write the data into separate hash array per milestone
db_foreach milestone_end_dates $changes_sql {
set key "$project_id-$audit_date"
set hash($key) [expr $end_julian - $reference_start_julian]
set cmd "set m${project_id}($audit_date) [expr $end_julian - $reference_start_julian]"
eval $cmd
}
if {0} {
set debug ""
foreach id $milestone_ids {
append debug "m $id: "
append debug [array get m{$id}]
append debug "\n"
}
ad_return_complaint 1 "<pre>$debug</pre>"
}
# ad_return_complaint 1 "<pre>[array get hash]</pre>"
# ToDo: We may have to fill "holes" in the array
# for milestones that don't have audit values for
# specific audit days.
set data_list {}
foreach audit_date $audit_dates {
# Reformat date for javascript
regexp {^(....)\-(..)\-(..)$} $audit_date match year month day
set data_line "{date: new Date($year, $month, $day)"
foreach id $milestone_ids {
set v 0
set key "$id-$audit_date"
if {[info exists hash($key)]} { set v [expr abs($hash($key))] }
append data_line ", m$id: $v"
}
append data_line "}"
lappend data_list $data_line
}
# Compile JSON for data
set data_json "\[\n"
append data_json "\t\t[join $data_list ",\n\t\t"]"
append data_json "\t\]\n"
# Compile JSON for field names
set fields {}
foreach id $milestone_ids {
lappend fields "'m$id'"
}
set fields_joined [join $fields ", "]
set fields_json "\['date', $fields_joined\]"
# ad_return_complaint 1 $fields_joined
# ad_return_complaint 1 "<pre>$fields_json\n\n$data_json</pre>"
<if @project_count@ ge 2>
<div id=@diagram_id@></div>
<script type='text/javascript'>
Ext.require(['Ext.chart.*', 'Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
window.store1 = Ext.create('Ext.data.JsonStore', {
fields: ['x_axis', 'y_axis', 'color', 'diameter', 'caption'],
data: @data_json;noquote@
});
function createHandler(fieldName) {
return function(sprite, record, attr, index, store) {
return Ext.apply(attr, {
radius: record.get('diameter'),
fill: record.get('color')
});
};
}
Ext.onReady(function () {
chart = new Ext.chart.Chart({
width: @diagram_width@,
height: @diagram_height@,
animate: true,
store: store1,
renderTo: '@diagram_id@',
axes: [{
type: 'Numeric',
position: 'left',
fields: ['y_axis'],
grid: true
}, {
type: 'Numeric',
position: 'bottom',
fields: ['x_axis']
}],
series: [{
type: 'scatter',
axis: 'left',
xField: 'x_axis',
yField: 'y_axis',
highlight: true,
markerConfig: { type: 'circle' },
renderer: createHandler('xxx'),
label: {
display: 'under',
field: 'caption',
'text-anchor': 'left',
color: '#000'
},
tips: {
trackMouse: false,
anchor: 'right',
width: 120,
height: 25,
renderer: function(storeItem, item) {
this.setTitle(storeItem.get('x_axis') + ' / ' + storeItem.get('y_axis'));
}
}
}]
}
)});
</script>
</if>
# /packages/sencha-reporting-portfolio/lib/scatter-diagram.tcl
#
# Copyright (C) 2011 ]project-open[
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
# ----------------------------------------------------------------------
#
# ---------------------------------------------------------------------
# The following variables are expected in the environment
# defined by the calling /tcl/*.tcl libary:
# program_id
# diagram_width
# diagram_height
# sql Defines the columns x_axis, y_axis, color and diameter
# Create a random ID for the diagram
set diagram_id "margin_tracker_[expr round(rand() * 100000000.0)]"
set x_axis 0
set y_axis 0
set color "yellow"
set diameter 5
set title ""
set data_list {}
set project_count 0
db_foreach scatter_sql $sql {
if {$project_count > 10} { continue }
lappend data_list "{x_axis: $x_axis, y_axis: $y_axis, color: '$color', diameter: $diameter, caption: '$title'}"
incr project_count
}
set data_json "\[\n"
append data_json [join $data_list ",\n"]
append data_json "\n\]\n"
# ad_return_complaint 1 "<pre>$data_json</pre>"
\ No newline at end of file
<?xml version="1.0"?>
<!-- Generated by the OpenACS Package Manager -->
<package key="sencha-reporting-portfolio" url="http://openacs.org/repository/apm/packages/sencha-reporting-portfolio" type="apm_application">
<package-name>]project-open[ Sencha Portfolio Reporting</package-name>
<pretty-plural>]project-open[ Sencha Portfolio Reporting</pretty-plural>
<initial-install-p>f</initial-install-p>
<singleton-p>t</singleton-p>
<implements-subsite-p>f</implements-subsite-p>
<inherit-templates-p>f</inherit-templates-p>
<auto-mount>sencha-reporting-portfolio</auto-mount>
<version name="4.0.3.0.0" url="http://www.project-open.org/download/apm/sencha-reporting-portfolio-4.0.3.0.0.apm">
<owner url="mailto:frank.bergmann@project-open.com">Frank Bergmann</owner>
<summary>Interface to Sencha JavaScript Libraries</summary>
<vendor url="http://www.project-open.com/">]project-open[</vendor>
<description format="text/plain">Supports chart and other Sencha widgets.</description>
<maturity>0</maturity>
<provides url="sencha-reporting-portfolio" version="4.0.1.0.0"/>
<requires url="sencha-v400" version="4.0.1.0.0"/>
<requires url="intranet-core" version="4.0.1.0.0"/>
<requires url="intranet-rest" version="4.0.1.0.0"/>
<callbacks>
</callbacks>
<parameters>
<!-- No version parameters -->
</parameters>
</version>
</package>
-- /packages/sencha-reporting-portfolio/sql/postgresql/sencha-reporting-portfolio-create.sql
--
-- ]project[ Sencha Portfolio Reporting
-- Copyright (c) 2003 - 2012 ]project-open[
--
-- All rights reserved. Please check
-- http://www.project-open.com/license/ for details.
-- @author frank.bergmann@project-open.com
----------------------------------------------------
-- Portlets
----------------------------------------------------
SELECT im_component_plugin__new (
null, -- plugin_id
'im_component_plugin', -- object_type
now(), -- creation_date
null, -- creation_user
null, -- creation_ip
null, -- context_id
'Sales Pipeline', -- plugin_name
'sencha-reporting-portfolio', -- package_name
'right', -- location
'/intranet/projects/index', -- page_url
null, -- view_name
10, -- sort_order
'sencha_scatter_diagram -diagram_width 300 -diagram_height 300 -sql "
select p.presales_value as x_axis,
p.presales_probability as y_axis,
''blue'' as color,
sqrt(coalesce(p.presales_value, 200.0)) / 10.0 as diameter,
p.project_name as title
from im_projects p
where p.parent_id is null and
p.project_status_id in (select * from im_sub_categories(71)) and
p.presales_value is not null and
p.presales_probability is not null and
p.presales_value > 0 and
p.presales_probability > 0
order by
p.project_id
" -diagram_caption "Shows presales value vs. probability for potential projects."'
);
SELECT im_component_plugin__new (
null, -- plugin_id
'im_component_plugin', -- object_type
now(), -- creation_date
null, -- creation_user
null, -- creation_ip
null, -- context_id
'Margin Tracker', -- plugin_name
'sencha-reporting-portfolio', -- package_name
'right', -- location
'/intranet/projects/index', -- page_url
null, -- view_name
20, -- sort_order
'sencha_scatter_diagram -diagram_width 300 -diagram_height 300 -sql "
select p.presales_value as x_axis,
p.presales_probability as y_axis,
''blue'' as color,
sqrt(coalesce(p.presales_value, 200.0)) / 10.0 as diameter,
p.project_name as title
from im_projects p
where p.parent_id is null and
p.project_status_id in (select * from im_sub_categories(76)) and
p.presales_value is not null and
p.presales_probability is not null and
p.presales_value > 0 and
p.presales_probability > 0
order by
p.project_id
" -diagram_caption "Shows planned vs. current margin of open projects."'
);
SELECT im_component_plugin__new (
null, -- plugin_id
'im_component_plugin', -- object_type
now(), -- creation_date
null, -- creation_user
null, -- creation_ip
null, -- context_id
'Milestone Tracker', -- plugin_name
'sencha-reporting-portfolio', -- package_name
'left', -- location
'/intranet/projects/view', -- page_url
null, -- view_name
10, -- sort_order
'sencha_milestone_tracker -project_id $project_id -diagram_caption "Milestones" -diagram_width 300 -diagram_height 300'
);
-- /packages/sencha-reporting-portfolio/sql/postgresql/sencha-reporting-portfolio-drop.sql
--
-- ]project-open[ Sencha Drop Scrip
--
-- Copyright (C) 2011 ]project-open[
--
-- This program is free software. You can redistribute it
-- and/or modify it under the terms of the GNU General
-- Public License as published by the Free Software Foundation;
-- either version 2 of the License, or (at your option)
-- any later version. This program is distributed in the
-- hope that it will be useful, but WITHOUT ANY WARRANTY;
-- without even the implied warranty of MERCHANTABILITY or
-- FITNESS FOR A PARTICULAR PURPOSE.
-- See the GNU General Public License for more details.
-----------------------------------------------------
-- Drop menus and components defined by the module
select im_menu__del_module('sencha-reporting-portfolio');
select im_component_plugin__del_module('sencha-reporting-portfolio');
# /packages/sencha-reporting-portfolio/tcl/sencha-reporting-portfolio-procs.tcl
#
# Copyright (C) 2012 ]project-open[
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
ad_library {
@author frank.bergmann@project-open.com
}
# ----------------------------------------------------------------------
# Portlets
# ---------------------------------------------------------------------
ad_proc -public sencha_scatter_diagram {
{-diagram_width 200 }
{-diagram_height 200 }
{-diagram_caption "" }
-sql:required
} {
Returns a HTML code with a Sencha scatter diagram.
@param sql A sql statement returning the rows x_axis,
y_axis, color and diameter for each dot to be displayed.
} {
# Choose the version and type of the sencha libs
set version "v407"
set ext "ext-all-debug-w-comments.js"
# Make sure the Sencha library is loaded
template::head::add_css -href "/sencha-$version/ext-all.css" -media "screen" -order 1
# template::head::add_javascript -src "/sencha-$version/bootstrap.js" -order 2
template::head::add_javascript -src "/sencha-$version/$ext" -order 2
set params [list \
[list diagram_width $diagram_width] \
[list diagram_height $diagram_height] \
[list diagram_caption $diagram_caption] \
[list sql $sql] \
]
set result [ad_parse_template -params $params "/packages/sencha-reporting-portfolio/lib/scatter-diagram"]
return [string trim $result]
}
ad_proc -public sencha_milestone_tracker {
-project_id:required
{-diagram_width 300 }
{-diagram_height 300 }
{-diagram_caption "" }
{-diagram_title "Milestones" }
} {
Returns a HTML code with a Sencha line diagram representing
the evolution of the project's milestones (sub-projects marked
as milestones or with a type that is a sub-type of milestone).
@param project_id The project to show
} {
# Check if the project is a main project and abort otherwise
# We only want to show this diagram in a main project.
set parent_id [db_string parent "select parent_id from im_projects where project_id = :project_id" -default ""]
if {"" != $parent_id} { return "" }
# Choose the version and type of the sencha libs
set version "v407"
set ext "ext-all-debug-w-comments.js"
# Make sure the Sencha library is loaded
template::head::add_css -href "/sencha-$version/ext-all.css" -media "screen" -order 1
# template::head::add_javascript -src "/sencha-$version/bootstrap.js" -order 2
template::head::add_javascript -src "/sencha-$version/$ext" -order 2
set ext "ext-all-debug-w-comments.js"
set params [list \
[list project_id $project_id] \
[list diagram_width $diagram_width] \
[list diagram_height $diagram_height] \
[list diagram_title $diagram_title] \
[list diagram_caption $diagram_caption] \
]
set result [ad_parse_template -params $params "/packages/sencha-reporting-portfolio/lib/milestone-tracker"]
return [string trim $result]
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Milestone Tracker</title>
<link rel="stylesheet" type="text/css" href="/sencha-v407/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/sencha-v407/examples/shared/example.css" />
<script type="text/javascript" src="/sencha-v407/ext-all-debug-w-comments.js"></script>
</head>
<body id="docbody">
<h1>Milestone Tracker</h1>
<div id=milestone_tracker_41290226></div>
<script type='text/javascript'>
Ext.require(['Ext.chart.*', 'Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
Ext.require(['Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
window.store = Ext.create('Ext.data.JsonStore', {
fields: ['date', 'm18232'],
data: [
{date: new Date(2010, 07, 19), m18232: 383},
{date: new Date(2011, 02, 07), m18232: 343},
{date: new Date(2012, 04, 03), m18232: 310}
]
});
Ext.onReady(function () {
chart = new Ext.chart.Chart({
width: 600,
height: 400,
animate: false,
store: store,
renderTo: 'milestone_tracker_41290226',
legend: { position: 'right' },
axes: [{
type: 'Numeric',
position: 'left',
fields: ['m18232'],
minimum: 0,
maximum: 400
}, {
type: 'Time',
position: 'bottom',
fields: 'date',
dateFormat: 'M',
groupBy: 'year,month,day',
aggregateOp: 'sum',
constrain: true,
fromDate: new Date(2010, 6, 19),
toDate: new Date(2012, 4, 3)
}],
series: [{
type: 'line',
axis: 'left',
highlight: true,
xField: 'date',
yField: 'm18232',
markerConfig: { type: 'circle', radius: 5, size: 5 }
}]
}
)});
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Milestone Tracker</title>
<link rel="stylesheet" type="text/css" href="/sencha-v407/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/sencha-v407/examples/shared/example.css" />
<script type="text/javascript" src="/sencha-v407/ext-all-debug-w-comments.js"></script>
</head>
<body id="docbody">
<h1>Milestone Tracker</h1>
<div id=milestone_tracker_41290226></div>
<script type='text/javascript'>
Ext.require(['Ext.chart.*', 'Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
Ext.require(['Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
window.store = Ext.create('Ext.data.JsonStore', {
fields: ['date', 'm18232'],
data: [
{date: '2010-07', m18232: 383},
{date: '2011-02', m18232: 343},
{date: '2012-04', m18232: 310}
]
});
Ext.onReady(function () {
chart = new Ext.chart.Chart({
width: 600,
height: 400,
animate: false,
store: store,
renderTo: 'milestone_tracker_41290226',
legend: { position: 'right' },
axes: [{
type: 'Numeric',
position: 'left',
fields: ['m18232'],
minimum: 0,
maximum: 400
}, {
type: 'Category',
position: 'bottom',
fields: 'date'
}],
series: [{
type: 'line',
axis: 'left',
highlight: true,
xField: 'date',
yField: 'm18232',
markerConfig: { type: 'circle', radius: 5, size: 5 }
}]
}
)});
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Milestone Tracker</title>
<link rel="stylesheet" type="text/css" href="/sencha-v407/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/sencha-v407/examples/shared/example.css" />
<script type="text/javascript" src="/sencha-v407/ext-all-debug-w-comments.js"></script>
</head>
<body id="docbody">
<h1>Milestone Tracker</h1>
<div id=milestone_tracker_41290226></div>
<script type='text/javascript'>
Ext.require(['Ext.chart.*', 'Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
Ext.require(['Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
window.store = Ext.create('Ext.data.JsonStore', {
fields: ['date', 'm18232', 'm18239', 'm18245'],
data: [
{date: new Date(2010, 06, 19), m18232: 3, m18239: 336, m18245: 69, m27466: 362},
{date: new Date(2011, 02, 07), m18232: 383, m18239: 336, m18245: 69, m27466: 0},
{date: new Date(2012, 04, 03), m18232: 310, m18239: 198, m18245: 349, m27466: 114}
]
});
Ext.onReady(function () {
chart = new Ext.chart.Chart({
width: 600,
height: 400,
animate: false,
store: store,
renderTo: 'milestone_tracker_41290226',
// legend: { position: 'right' },
axes: [{
type: 'Numeric',
position: 'left',
fields: ['m18232'],
minimum: 0,
maximum: 400
}, {
type: 'Time',
position: 'bottom',
fields: 'date',
title: 'Day',
dateFormat: 'Y M',
groupBy: 'year,month,day',
aggregateOp: 'sum',
constrain: false,
// majorTickSteps: 8,
step: [Ext.Date.MONTH, 3],
fromDate: new Date(2010, 1, 1),
toDate: new Date(2013, 1, 1)
}],
series: [{
type: 'line',
axis: ['left','bottom'],
highlight: true,
xField: 'date',
yField: 'm18232',
markerConfig: { radius: 5, size: 5 }
}]
}
)});
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Bar Chart</title>
<link rel="stylesheet" type="text/css" href="/sencha-v407/ext-all.css" />
<link rel="stylesheet" type="text/css" href="/sencha-v407/examples/shared/example.css" />
<script type="text/javascript" src="/sencha-v407/ext-all-debug-w-comments.js"></script>
</head>
<body id="docbody">
<h1>Stacked Bar Chart Sample</h1>
<div id=@diagram_id@></div>
<script type='text/javascript'>
Ext.require(['Ext.chart.*', 'Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit']);
window.store1 = Ext.create('Ext.data.JsonStore', {
fields: ['x_axis', 'y_axis', 'color', 'diameter', 'caption'],
data: @data_json;noquote@
});
function createHandler(fieldName) {
return function(sprite, record, attr, index, store) {
return Ext.apply(attr, {
radius: record.get('diameter'),
fill: record.get('color')
});
};
}
Ext.onReady(function () {
chart = new Ext.chart.Chart({
width: 200,
height: 200,
animate: true,
store: store1,
renderTo: '@diagram_id@',
axes: [{
type: 'Numeric',
position: 'left',
fields: ['y_axis'],
grid: true
}, {
type: 'Numeric',
position: 'bottom',
fields: ['x_axis']
}],
series: [{
type: 'scatter',
axis: 'left',
xField: 'x_axis',
yField: 'y_axis',
highlight: true,
renderer: createHandler('xxx'),
label: {
display: 'middle',
field: 'caption',
'text-anchor': 'middle',
contrast: true
},
markerConfig: {
type: 'circle'
}
}]
}
)});
</script>
</body>
</html>
# /packages/intranet-sencha/lib/margin-tracker.tcl
#
# Copyright (C) 2011 ]project-open[
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
set diagram_width 200
set diagram_height 200
# ----------------------------------------------------------------------
#
# ---------------------------------------------------------------------
# The following variables are expected in the environment
# defined by the calling /tcl/*.tcl libary:
# program_id
# diagram_width
# diagram_height
# sql Defines the columns x_axis, y_axis, color and diameter
# Create a random ID for the diagram
set diagram_rand [expr round(rand() * 100000000.0)]
set diagram_id "margin_tracker_$diagram_rand"
set x_axis 0
set y_axis 0
set color "yellow"
set diameter 5
set title "Scatter Diagram"
set data_list {}
set i 0
set sql "
select p.presales_value as x_axis,
p.presales_probability as y_axis,
'yellow' as color,
1 as diameter
from im_projects p
where p.parent_id is null and
p.presales_value is not null and
p.presales_probability is not null and
p.presales_value > 0 and
p.presales_probability > 0
order by
p.project_id
"
db_foreach scatter_sql $sql {
if {$i > 10} { continue }
lappend data_list "{x_axis: $x_axis, y_axis: $y_axis, color: '$color', diameter: $diameter, caption: '$title'}"
incr i
}
set data_json "\[\n"
append data_json [join $data_list ",\n"]
append data_json "\n\]\n"
# ad_return_complaint 1 "<pre>$data_json</pre>"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment