Bar Chart and Multi-Value Slider Demo
A classic textbook example,
BarDial
draws a bar chart,
with stacked sectors for given colors and values.
BarControl
extends BarDial,
as a multi-value slider control,
able to resize sectors in response to mouse drags,
and report such changes as Action events.
Typical use would be setting a "comfort range" in green,
with high and low "action ranges" in yellow,
and high and low "alarm ranges" in red.
This
BarDemo applet
shows it in use.
Can't run this?
Methods not found?
Try the Java 1.0.2 version.
But simply following this link may not work,
because your browser already has loaded the class files.
So,
follow and bookmark this link,
BarDemo for Java 1.0.2 event model.
exit and restart the browser,
visit the saved link.
-
Drags on a border separating segments shifts the border,
thus changing the relative sizes of those segments.
Note that two of the controls have been linked in this demo,
so dragging in either one updates both.
Just to show we can.
You cannot drag a sector boundary across another one,
but you can use one to "push" others along.
-
Other responses could be programmed,
for example Click to divide a segment in two,
when pre-enabled by some other control.
We would need a new color for it.
Also see a
pie chart and circular multi-value slider.
Other Java..
This code back-fit to 1.0 event model.
Please also visit my home page.
Was this Helpful?
Was this Helpful?
Was it what you were looking for?
Suggestions?
How did you find this page?
Search result,
following a link,
recommendation?
Please let me know.
Email
me at morris_hirsch@brown.edu
Legalities
This software is provided free of charge with no support.
Email
me at morris_hirsch@brown.edu
if you do have a problem,
and I will try to help,
but I cannot promise to.
Except for all sections which are identified as the work,
and copyright,
of others,
this work is Copyright (C) 1998 by Morris Hirsch.
All rights reserved,
except as granted here.
Redistribution and use in source and binary forms,
with or without modification,
for any purpose,
are permitted,
except as may be restricted by original copyright holders,
provided that the following conditions are met:
-
Redistributions of source code must retain the above copyright notice,
all earlier copyright notices of others,
this list of conditions and the following disclaimer.
-
Redistributions in binary form must reproduce the above copyright notice,
all earlier copyright notices of others,
this list of conditions and the following disclaimer,
in the documentation,
and/or other materials provided with the distribution.
DISCLAIMER
This software is provided free of charge with no support.
This software is provided in source format;
You are advised to examine it and understand it,
before putting it to use.
This software uses only algorithms and coding techniques
that are available to the public in the open literature.
You are however,
advised to make your own determination of legality,
for your intended use.
This software is provided by the Author and Contributors ``AS IS''
and any express or implied warranties,
including, but not limited to,
the implied warranties of merchantability
and fitness for a particular purpose,
are disclaimed.
In no event shall the Author or Contributors,
or their Agents,
be liable for any direct, indirect, incidental, special, exemplary,
or consequential damages
(including, but not limited to,
procurement of substitute goods or services;
loss of use, data, or profits;
or business interruption)
however caused and on any theory of liability,
whether in contract, strict liability,
or tort (including negligence or otherwise)
arising in any way out of the use of this software,
even if advised of the possibility of such damage.