I am trying to change the default functionality of enhancedLegendRendrer.js where in on clicking on the legend series that particular bar item in the graph gets visible/hidden.I want to change this default functionality, wherein if the user clicks on the legend series item only that series is displayed while rest of the bars are made invisible.
Jumped the gun on the post and now cannot delete. Thought the above was asking how to enable toggling on legend. Anyway, for anyone interested:
https://bitbucket.org/jab/jqplot/src/edd2f5972593/examples/legendLabels.html
Related
In the dc.js examples I have seen, the user applies a filter to a dimension by selecting values on a chart - and sometimes by selecting a legend item. How does one implement a dedicated control for selecting values?
So if you want a one off custom UI control, you can handle the events and call the relevant filters and redraw (the same way it's done when clicking on existing charts)
If you want to have something re-usable, you need to implement a new "graph" type, check the select menu code, it's not a lot of extra boilerplate
Btw, between combo box and select menu, you should be able to implement everything but the sider
I'm looking to build a clickable drill-down bar chart of sorts using dimple or nvd3.
I can create a bar chart no problem, but what I'd like to do is make each bar clickable to allow me to call a Javascript function which will load JSON to populate a separate chart (essentially doing a drill-down across multiple charts)
The problem however seems to be that I can only access the value or label in the series to the item I've selected, and in order to load the next chart I would need something distinct... another field from my recordset or even the index of the bar being clicked on.
Being new to dimple, I'm looking for a simple example but everything I'm seeing seems to involve drill-downs in the same chart or examples showing far more features than I need.
I'm just looking for a way to bind an event to each item in the series, and to use data during the click event that would be unique to that data point, but not used in the chart.
You can add events to a series using the series.addEventHandler method documented here.
This example is essentially a drill through but using the hover event instead of the click.
I'm faced with a problem where I need to display some characters in a tree-view item (those belonging to the Symbol charset) using Symbol font while others in the default System font (Segoi UI on my Windows 7).
Custom draw allows us to draw different items using different fonts, but I would like to draw the same item string using different fonts as it applies to each character in the string as told above.
So, what I've done with not-so-pleasing results w.r.t. drawing performance upon a horizontal scroll when the number of items is more so far is this:
I disabled horizontal scrolling in my tree-view control using TVS_NOHSCROLL style (since I'm using my own scroll bar control inside the tree-view window to handle all horizontal scrolling)
I sub-classed the treeview control and in the sub-classed winproc, I handle the horizontal scroll notification and mouse notification (where I do my own hittesting and send message like TVM_EXPAND and TVM_SELECT as a result of mosue clicks/double-clicks). Also the scroll bar range is set based on how wide my custom drawn string is (the maximum length amongst all items).
I draw the string for each item upon receiving CDDS_ITEMPOSTPAINT using my own fonts for each character in the item.
The above approach (I left out some details for the sake of brevity) works BUT there are some problems which makes me post this question here and look for an alternare way:
Problems:
The horizontal scroll bar control I create is hosted "inside" the tree-view control at the bottom of the tree-view window. However, when the number of items goes beyond what the tree-view client area can accommodate vertically, the last visible tree-view item gets obscured by the scroll bar control. This can be solved by not making the scroll bar a child of the tree-view and hosting it outside the tree-view window just below it. But I don't want to do this since the scroll bar should typically be a child window of the tree-view.
This is the major one. Since I draw the items myself at each horizontal scroll, the drawing performance upon horizontal scrolling is very slow and also leads to flicker upon scrolling.
Any ideas will be much appreciated as I've been grappling with this for the last one week without success.
I can also post the relevant code here if you want to see the approach I took but I'm sure there shoould be a better approach to this and there must be some other people who would've faced this problem and solved it in the past.
Thanks in advance.
Custom-draw allows you to draw items however you want. You are not limited to a single font per item. When you receive the NM_CUSTOMDRAW notification, draw whatever you want on the provided HDC for the specified item. You can draw pieces of text in one font, pieces of text in a different font, etc. Be sure to return CDRF_SKIPDEFAULT so the TreeView itself will not try to draw anything on the item.
#Anurag S Sharma: I tried to edit this into Remy's answer. It's incomplete as is, but addresses your comment/concerns and answers this particularly vexing/useful question...
The problem is that ff I return CDRF_SKIPDEFAULT, Windows does not even draw the +/- buttons (expanding/collapsing) nor the indent lines in the control which I do want Windows to draw. – Anurag S Sharma
To retain the lines, buttons, and icons you can use ExcludeClipRect to mask only the text region and instead of returning CDRF_SKIPDEFAULT, return 0 as if you didn't draw anything. This itself would not be necessary if the text of the tree item was empty, except that the margins of the text will always be drawn by the default handler (note that Microsoft's controls do not always respect clipping shapes, but in this case they do.)
To replicate the classic TreeView label style in your custom draw procedure you need to do something like the following:
HTREEITEM item = (HTREEITEM)p->dwItemSpec;
TreeView_GetItemRect(p->hdr.hwndFrom,item,&p->rc,1);
RECT cr, rc = p->rc; GetClientRect(p->hdr.hwndFrom,&cr);
DrawTextW(p->hdc,text,-1,&rc,DT_CALCRECT|DT_NOPREFIX|DT_NOCLIP);
rc.right+=4; rc.bottom+=2; IntersectRect(&rc,&cr,&rc);
ExtTextOutW(p->hdc,rc.left+2,rc.top+1,ETO_CLIPPED|ETO_OPAQUE,&rc,text,wcslen(text),0);
When the NSLevelIndicator (in star ratings mode) is interacted with it shows placeholder dots for where there are no stars. These dots however fade once the interaction with the NSLevelIndicator is seized. This brings with it obvious UI problems because the user is no longer aware that there is a NSLevelIndicator to be interacted with. Is there any way to force the continuous highlighting of the indicator so that the dots do not fade?
I found an answer here: http://www.cocoabuilder.com/archive/cocoa/202167-rating-style-levelindicator-not-showing-dots.html
Basically the control's cell needs to have its 'highlighted' property set to YES for the dots to show. Their solution involves subclassing NSLevelIndicatorCell; I found a simpler way that seems to work fine, which is to set the control's cell's highlight to YES when it's initially created, and after it's clicked and sends its action message. (You have to keep highlighting it because it loses the highlight after each click for some reason.)
I am working on a win 32 sample. In that I am using List Box to Display the List of user. I am using the setting the owner draw flag to draw the items. It is working fine.
But I want to customize the scrollbar of the list view. How to do it.
Please let me know how to customize the scrollbar.
Scrollbars are usually native, even for custom draw items. If you really want to customize them, take a look at this library & tutorial.