how to remove the label in the linechart in primefaces 3.3.1 - jsf

I am trying to remove the label in the linechart. For that i have tried by giving empty label but in the graph it dispayed color box without the label .
ChartSeries boys = new ChartSeries();
boys.setLabel("");
If i tried without setting the label. It displayed color box with "null" as label.

I don't know if this is an option for you, but you could hide the entire legend box using css. Something like this:
.jqplot-table-legend {
display: none;
}

Solved my issue
yourChart.options = {
legend: {
display: false,
}
};

Related

Tabulator table: Change font

I'm trying to use the Tabulator table. Changing theme (including different .css), I get new background and foreground colors but the font is always times new roman. How do I change it ?
Use it like this:
.tabulator {
font-family: "Courier New";
}

How to make label text in jointjs elements not selectable?

i'm trying to find a solution for the following. When I drag a link between elements the label text inside the elements get selected for some reason.
Lets say I have an element A with the property A.attr("body/magnet", "active"); set and A.attr("label/text", "some text"); When I create a link from that element by clicking and dragging the label text gets selected on elements the link goes through.
This seems a little bit random though as sometimes all the labels in the graph gets selected when dragging the link.
Is there a way to make the label text not to be selectable?
We solved it by adding the following label style to the shapes.
let element = new joint.shapes.standard.Rectangle();
element.attr(
"label/style",
"-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;"
);
From the answer above the links will still be selected, so you can put css on you #paper is or canvas like so
#paper {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

Primefaces: Charts and Legend position

I'm working on putting together a pretty basic stacked bar chart using Primefaces. The chart itself seems to build just fine. However, the legend is being placed over the chart data. I know you can move the legend to any compass ordinal (n, s, w, e, se, sw, ne, nw), but I'd actually like to move it OFF the data.
The code to get it in:
<p:barChart id="stackedKWH" value="#{kwhSalesBeanManager.kwhSalesChart}" legendPosition="e" style="height:300px;width:800px" title="kWh Sales by Type" stacked="true" barMargin="10" min="0" max="125000000" />
And what it currently looks like. Would like to move that legend off the chart to the right.
Try to add this :
function extLegend()
{
this.cfg.legend= {
show: true,
location: 's',
placement: 'outsideGrid'
};
}
and add this inside your barChart component :
extender="extLegend"
Now the best solution would be defining the placemant on chart model:
...
modelChart.setLegendPlacement(LegendPlacement.OUTSIDE);
...
Looks like you should use javascript for this purpose.
something like that:
var legend = $('table.jqplot-table-legend')[0];
legend.setAttribute('style', 'position: absolute; z-index: 3; right: -100px; top: 25px;');
I tested it on this page: http://www.primefaces.org/showcase/ui/barChart.jsf

Adding title text inside gauge Dojo

i need to insert a title (not a tooltip, a text on the top) inside the svg rendered by Dojo. How can i do that?
Here my Dgauge:
http://jsfiddle.net/MacroX/pZU93/1/
PD: The line
gauge.title = 'Test Report'
doesnt show the title
EDIT: The question is regarding a label at the top of the gauge, not the title attribute as I originally thought.
You can use a TextIndicator much like you did for the value label below the needle, but you can set a labelFunc property that defines a function called to set a label and displays whatever string is returned from it.
var labelText = new TextIndicator();
labelText.set('x', 73.3);
labelText.set('y', 55);
labelText.set('labelFunc', function() {return 'Test Report';});
gauge.addElement('labelText', labelText);
Here is a modified version of your fiddle with the title text in place.
Original answer remans below in case someone else needs it
Pass the title in when you create the gauge:
var gauge = new CircularLinearGauge({
title: 'Test Report'
}, dojo.byId("gauge"));
You can also use set to set it after the gauge is created:
gauge.set('title', 'Test Report'); //does work :)
The reason for this is that the gauge widget needs to set the text you give as the title on a specific element within the widget's template. gauge.title just sets the title property of the gauge widget, and the widget has no idea when or with what value that property is being set and thus is not able to make it show up as a title attribute on the gauge.
Finally i got a way to resolve this, and this is useful when you need to personalize your dgauge. Here the example:
http://jsfiddle.net/MacroX/THJqV/
What i did is basicly create a gauge, fill it with background white, and then add elements inside
var baseWidth = 400;
gauge.addElement("background", function (g) {
var auxHeight = baseWidth * objGauge.offsetHeight / objGauge.offsetWidth;
g.createRect({
width: 400, height: auxHeight
//width: 400, height: 300
}).setFill("#FFF");
});
I dont know if is the best way, but works and i didnt find something similar in other sites
And what I think is great, this support multiple chart dgauges in only one SVG
I hope this will useful to someone else

How to add different color to odd and even rows in a pygtk TreeView

I have created a pygtk TreeView and wanted to add different colors between each line. I went here and it says that there exists a TreeView Style property that does exactly the same.The property is called 'odd-row-color' and 'even-row-color'. So went to my code and tried to apply this by using the set_property(). But i get an error message for doing that
self.customer_view.set_property('even-row-color', gtk.gdk.Color(211, 211, 211))
TypeError: object of type `GtkTreeView' does not have property `even-row-color'
How can achieve that. And where is that property handled?
You can use css (GTK3) to change the colors, something like:
style_provider = Gtk.CssProvider()
css = '''
GtkTreeView row:nth-child(even) { background-color: shade(#base_color, 0.9); }
GtkTreeView row:nth-child(odd) { background-color: shade(#base_color, 1.0); }
'''
style_provider.load_from_data(css.encode('utf8'))
Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
style_provider,
Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
Make sure to tell GTK that you want to paint alternate colors:
treeview.set_rules_hint(True)

Resources