Add line break on label - jfreechart

I am using CategoryPointerAnnotation to draw an arrow and show label. Right now the label seems to be too wide. Is it possible to add a line break so that that $ amount shows up on the next line?
CategoryPointerAnnotation ann5 = new CategoryPointerAnnotation("You are here $" +
NumberFormat.getIntegerInstance().format(
num.intValue()), cat, num.intValue(), -2.35619449);

No, line-breaks are not supported. Neither in title, subtitles, labels, tooltips, etc. You can search the JFreeChart forum for "linebreak" or "newline" to find related posts. There have been featuers-requests and according to the forum there were even patches available to fix this, but none has made it into JFreeChart yet (as of 1.0.19).

Have you tried adding in System.getProperty("line.separator")?

Related

Are these highlighted lines part of actual code?

I was randomly searching for help related to old dsp kit6713 and i came across some links,one of interest is below
http://www.geethanjaliinstitutions.com/engineering/labmanuals/downloads/ece/dsp%20lab.pdf
On page 90/91 of document available on above link,there is a code,i have also attached snapshot of that code and highlighted the two lines with yellow color.
I wonder,in last line of snap,which value of filter_coeff (having red mark above)is being used here inside while loop in main function?from the two highlighted lines or the one below highlighted lines ?
In C single line comments begin with // so the two highlighted lines are comments which have no impact on the running code. The filter_coeff in use is the third one, the one that isn't highlighted. Presumably the three options are provided as common defaults. You could comment out the third filter_coeff and uncomment one of the others to change the band range, or you could presumably make your own filter_coeff if you knew exactly which values to use.

Is there a way to have a syntax that highlight single specific words in vim? [duplicate]

I want to search for multiple strings in Vim/gVim and have them highlighted in different colours. Is there a way of doing this with out-the-box Vim or with a plug-in?
There are two simple ways to highlight multiple words in vim editor.
Go to search mode i.e. type '/' and then type \v followed by the words you want to search separated by '|' (pipe).
E.g.: /\vword1|word2|word3
Go to search mode and type the words you want to search separated by '\|'.
E.g.: /word1\|word2\|word3
Basically the first way puts you in the regular expression mode so that you do not need to put any extra back slashes before every pipe or other delimiters used for searching.
This can be done manually, without any script, for two search patterns.
:match Search /pattern/
:match Search /<CTRL-R>/ # highlight the current search pattern
Search is the name of the highlight group, use the completion to select another group to highlight with a different color.
:match <TAB>
:match <TAB> # completion will list all highlight group
This an be handy when you cannot use your own vim configuration.
:match none # clear the match pattern to stop highlighting
For searching multiple strings in vim you can do like:
/search1\|search2
This works, and will highlight both search1 and search2, but with same color.
You have to do this in vim editor.
Try "Highlight multiple words", which uses matchadd().
Yes, out-of-the-box you can use matchadd().
To add a highlight, eg. for trailing whitespace:
:highlight ExtraWhitespace ctermbg=grey guibg=grey
:call matchadd('ExtraWhitespace', '\s\+$', 11)
To view all matches:
:echo getmatches()
To remove matches use matchdelete(). Eg.:
:call matchdelete(7)
:%s /red\|green\|blue/
I am not sure about how to keep different colors for different keyword though. Thanks.
MultipleSearch : Highlight multiple searches at the same time, each with a different color.
http://www.vim.org/scripts/script.php?script_id=479
:Search <pattern1> //will highlight all occurences of <pattern1> in the current buffer.
A subsequent :Search <pattern2> will highlight all occurences of <pattern2> in the current buffer.
My Mark plugin can highlight several words in different colors simultaneously, like the built-in search. It comes with many mappings and commands, allows to persist the patterns, and supports multiple color palettes.
MultipleSearch2 is another script which is integrated with vim's search:
http://www.vim.org/scripts/script.php?script_id=1183
I prefer highlight plugin, simple and enough, can highlight different words with differently colors automatically.
http://www.vim.org/scripts/script.php?script_id=1599

Polyline doesn't appear in glass://map image

The glass docs made it look so easy!
I can get my map drawn with start and end points, but the polyline to connect the two isn't getting rendered.
Here's a simple one:
glass://map?w=240&h=360&marker=0;28.036352,-82.422457&marker=1;28.044039,-82.421721&polyline=28.036352,-82.422457,28.044039,-82.421721
After a night and a day of throwing everything at it, still no joy. I must be Doing it Wrong(tm) ... I hope someone sees a problem hidden in plain sight (at least to me).
You're missing a semicolon right after polyline=. Here's the corrected URL:
glass://map?w=240&h=360&marker=0;28.036352,-82.422457&marker=1;28.044039,-82.421721&polyline=;28.036352,-82.422457,28.044039,-82.421721
The documentation says
Each polyline consists of a width and color followed by the vertices in the polyline. For example: polyline=8,ffff0000;47.6,-122.34,47.62,-122.40 specifies an 8-pixel wide red line between (47.6,-122.34) and (47.62,-122.40).
The proper format for a 2-point polyline is therefore:
polyline=WIDTH_IN_PIXELS, COLOR_IN_HEX; START_POINT_LAT, START_POINT_LONG, END_POINT_LAT, END_POINT_LONG,
You need to specify the semicolon to denote the end of the width, color tuple.

Adding a Dotted red line under characters in a UITextView

I am trying to create my custom spell checker for the UITextView.
To show that a word is misspelled, I need to add the "red dotted line" under the misspelled word.
To do that, here is what I thought would work -
I create a dictionary which contains the values for the key NSUnderlineStyleAttributeName.
However, what this does is, it does underline the characters but it does not have a dotted pattern.
Also, setting the strokeColorAttribute also does not seem to have any effect.
Here is my code -
NSMutableDictionary *misspelledAttributes = [NSMutableDictionary dictionary];
[misspelledAttributes setObject:[NSNumber numberWithInt:kCTUnderlineStyleThick|kCTUnderlinePatternDot] forKey:NSUnderlineStyleAttributeName];
[misspelledAttributes setObject:[UIColor redColor] forKey:NSStrokeColorAttributeName];
To set the attributes to a attributed string for a particular range -
NSMutableAttributedString *attrString = [self.textView.attributedText mutableCopy];
[attrString addAttributes:misspelledAttributes range:wordRange];
It would be great if someone could help me with this and point out what I am missing/doing wrong.
I think you are going to have to find an approach other than NSAttributedString.
As far as I can tell, your only value choices in iOS for NSUnderlineStyleAttributeName are NSUnderlineStyleNone or NSUnderlineStyleSingle, which represent numbers.
NSUnderlineColorAttributeName support iOS 7.0+.

how to (programmatically) scroll to a specific line in gtktextview/gtksourceview

I am creating a text editor as a way of getting more familiar with C and gtk+. I am using gtk+-2.0 & gtksourceview-2.0, and gtk_scrolled_window . As a first attempt at creating a goto function browser I thought I would just simply create an array of functions found in the document and a corresponding array of lines on which they occur. I have that much done. I was surprised to find that there is no goto line capability that I can easily find in devhelp. It sounds like gtk_text_view_scroll_to_mark () is what I want (after creating a mark), but all the *scroll_to functions require a within_margin, which to be honest I don't really understand.:
From devhelp:
The effective screen for purposes of this function is reduced by a margin of size within_margin.
What does that mean?
Am I even close? How can I create this scroll to line number functionality?
Thanks.
UPDATE: The following three functions were used to scroll to a line in the buffer:
gtk_text_iter_set_line (&start, lineNums[9]);
gtk_text_buffer_add_mark (tbuffer, scroll2mark, &start);
gtk_text_view_scroll_to_mark (text_view, scroll2mark, 0.0, TRUE, 0.0, 0.17);
The last parameter of gtk_text_view_scroll_to_mark was used to get the target line number to line up with the very top line in the buffer. I imagine this parameter will not work on all screen sizes, but I have not tested it.
The gtk_text_view_scroll_mark_onscreen function got me close to the line number, but it was just a couple of lines off the bottom of the text area.
The within_margin parameter controls the area of the screen in which the scrolled-to text should appear or more precisely it sets the amount of space at the border of the screen in which the text should not appear.
This exists so that when you set use_align to false (i.e. you don't want the text to appear at a specific position on the screen), you can still make sure that the text doesn't appear directly at the top of bottom of the screen (which might be bad for readability purposes).
If you don't care at all about the position at which the text will appear, you can use g_text_view_scroll_mark_on_screen which only takes the text view and a mark and no further arguments. This will always scroll the minimum amount to make the text appear on screen.

Resources