display items' values in bar chart in Jpgraph - codeigniter

I am using jpgraph bar chart. It all works fine but there is one thing I could not really figure it out. I need to display the value of each bar on the top of that bar (column) but it seems like I am missing something that I cant do it.
I have tried using the following:
$bplot->value->Show();
But yet it does not work! Any help is GREATLY appreciated!

It is an old question, but as I had the same problem and I solved it, I'm posting this answer as a future reference.
My problem was the order of the invoked methods. You MUST call Show after addnig the plot to the graph. As an example:
$graph = new \Graph($width, $height);
[... init graph ...]
$plot = new \BarPlot($datay);
$graph->Add($plot);
$plot->value->Show();
$plot->value->SetColor("black","darkred");
$plot->value->SetFormat('%01.2f');
I hope it helps someone.

Call the Show() method after you've added the plot to the graph.
$graph->Add($plot);
$plot->value->Show();

This example shows it can be done, and it gives a complete example of how to pull it off:
http://enacit1.epfl.ch/php/jpgraph/docs/html/exframes/frame_example20.1.html
I'd be glad to look at your code and troubleshoot if you require help beyond this.

Putting the value on top of the bar:
$bplot->SetValuePos('top');
Changing the angle:
$bplot->value->SetAngle(90);
Hiding value that are 0:
$bplot->value->HideZero();

Related

ScintillaNet - detect mouse over

is it possible to react when the mouse is over a word ? Suppose I want to show a bubble with a description of the thing I'm currently hovering. Seems strangely difficult to do.
I think it is possible but might be a little hard.
You have the MouseHover event however you don't know what word you hovered so it might be a little hard.
You can get the mouse localization with this:
Point mouseLocation = new Point(e.X, e.Y)
Then if you use a fixed-width type font you know the size of each line/character then you can calculate it.
Some code that helps with position/line transition:
var line = scintilla.LineFromPosition(startPos);
startPos = scintilla.Lines[line].Position;
scintilla -> Control Name
For a better view try seeing this:
https://github.com/jacobslusser/ScintillaNET/wiki/Custom-Syntax-Highlighting
https://github.com/jacobslusser/ScintillaNET/wiki/Basic-Text-Retrieval-and-Modification
Edit:
Not really a good answer soo 2nd try
[scintilla name].CurrentPosition -> you can get the word you selected if I'm not mistaken but I don't know if you can do it by hovering.
Then do the interpretation of the word and it might work.
Try reading this:
https://github.com/jacobslusser/ScintillaNET/issues/149
3rt Try.
Let's hope it's the best one.
https://github.com/Ahmad45123/AutoCompleteMenu-ScintillaNET
There is AutoCompleteMenu for Scintilla that has a hover property.
I'm not sure how it works but might be what you're searching for.

Issue when moving up down in a THorzScrollBox to scroll it's parent TVertScrollBox

I'm facing a problem with this 2 ScrollBox, one is TVertScrollBox which display whole screen and it have a THorzScrollBox in it, my problem is if i want to touch to the HorzScrollbox item and move up and down, my VertScrollBox have to scroll same as. Are there any ways to solve this issue? Thanks in advance
//Edit 1 : I'm using a gesture and ScrollBy(x,y) function to do with this issue. But it seem a bit laggy(not smooth) and still the HorzitonScrollBox scroll it own. A image for this(http://i.imgur.com/weOqW0R.gifv). Still watting another solution to do this
You can do it using UICollectionView as given in below example project.
http://damir.me/implementing-uicollectionview-layout
Source code link: http://bascarsija.s3.amazonaws.com/CollectionView.zip
After downloading this source code, In build settings change the value of the "Compiler for C/C++/Objective-C" to Default Compiler and run the app.
OK, I have found a simple answer.
When you have a THorzScrollBox inside of a TVertScrollBox, set THorzScrollBox.Touch.InteractiveGestures.Pan to False.

Sliding bottomsheet like redbus

I want to implement a search feature similar to the redbus app. The screenshots are shown below. When I click on editbox, it should slide the sheet(from bottom) with the name of the cities as shown in screenshot2 and when I select any one of them, it should dismiss and fill the selected details in edit box. I have already tried working with bottomsheet, but could not find a way. Please help.
This is an angular material directive called bottom sheet:
https://material.angularjs.org/latest/demo/bottomSheet
You can use
startactivityforresult(my intent,1)
In your app. Let me know if you want any further help. Hope this helps u nuf.

NVD3.js: Where is the documentation? Need help to configure some functionalities

I'm starting to work with NVD3.js and I'm a little lost about the configurations possible with this tool.
I want to configure many items like:
Display x axis label for every bar, currently I have only the even ones displaying:
I want to configure a click function on the bars, which will redirect to a page passing the x axis as parameter, this link can be displayed on the label, but in this case I need to change it, to be able to click on it.
These are my doubts, can someone help me with the documentation link or with the answer to my questions?
-- EDIT --
Found how to display the label for every bar on x axis:
In the nv.d3.js edit the function nv.models.multiBarChart. In this line: reduceXTicks = true, set the value to false.
or
Just add this line to your nv.addGraph function:
chart.reduceXTicks('false');
Development of NVD3 appears to have moved to the nvd3-community fork which has documentation available.
Agreed with shabeer90. There is no documentation for NVD3 (wish there was).
D3.js documentation is of course largely in play...
Thanks for all replies, but I've done it by myself:
For displaying x axis label for every bar:
Add chart.reduceXTicks('false'); to your nv.addGraph() function, like this:
nv.addGraph(function () {
var chart = nv.models.multiBarChart();
chart.reduceXTicks(false);
return chart;
});
For adding an event to click on the bars, use this on your chart function:
d3.selectAll("rect.nv-bar").on("click", function (d) { // You can pass d to function to recover x ou y value of the bar
// Whatever you want to do on click
});
If someone has a better solution, please comment here.
While not the ideal solution, I find it easier to find out the available configuration options by using the link below and tinkering with the parameters on the right until I get the results I want. It's for an angularjs wrapper to nvd3, but the configuration is pretty much the same, only through JSON instead.
https://krispo.github.io/angular-nvd3/#/historicalBarChart
There is documentation for the API here. None of these tools are going to be useful until someone comes along with an abstraction that simply ingests JSON. Nobody wants to code a damn graph.
https://github.com/novus/nvd3/wiki/API-Documentation

wxPython: StatusBar does NOT update with long help from wxToolBar

I am creating a ToolBar within a wx.Frame init and setting the help string as follows:
def __init_(self,...):
...
self.CreateStatusBar()
tb = self.CreateToolBar(wx.TB_HORIZONTAL|wx.NO_BORDER|wx.TB_FLAT)
tb.SetToolBitmapSize((32,32))
tb.SetSize((-1,132))
tb.AddTool(ID_CLASSIFIER, bmp, shortHelpString='Classifier', longHelpString='Launch Classifier')
...
tb.Realize()
--yet when I mouseover the toolbar icons, the StatusBar does not get updated. I had the same problem when adding PlateButtons to the toobar instead of using AddTool. Does anyone know what I'm doing wrong?
EDIT: Just tested this on Windows and it works. Turns out it's a Mac specific problem. That said, I'm still looking for a solution.
Thanks,
-Adam
I use AddLabelTool in my code and that does show the help text on the status bar:
toolbar.AddLabelTool(self.id, '', bitmap, wx.NullBitmap, self.kind,
shortHelp=wx.MenuItem.GetLabelFromText(self.menuText),
longHelp=self.helpText)

Resources