ZPL Horizontal Line - zpl

I'm looking for a way to do a horizontal line in ZPL.
I could do a vertical one with the ^GD command (^GD3,250,3,B,L)
And I did some bad horizontal one with that same command playing with width/height/thickness. But let's be honest, it looks like **** :D
Here is how it looks like :
Anyone having an idea ? Thanks a lot in advance :)
Doing the horizontal line with ^GD800,3,250,B,L , that is really bad looking !

Use the ^GB (graphic box) command and specify zero for the height. For example, ^GB800,0,3,B should get you a 3px horizontal line 800 pixels long.
Also use ^GB for vertical lines, where you specify a zero width and a non-zero height. For example, ^GB0,400,3,B should render a 3px vertical line 400 pixels long.

Related

How to find the size of the padding in d3.js scaleBand

I'm making sparklines next to bar charts but trying to get the positioning right.
The bars are set out with d3.scaleBand().paddingInner(0.1)
I'm translating the line paths by y.bandwidth() which gets me close (see below).
It looks like it needs to add a bit more for the padding. How much is the padding? It's set at 0.1 but 0.1 of what? How do I find out the padding in pixel to add to the translate?
Code is currently at https://github.com/henryjameslau/new-trade-map/blob/master/worldmap/index2.html
After reading the readme for d3-scale it says
The inner padding determines the ratio of the range that is reserved
for blank space between bands.
so the answer is 0.1 of the range which is set in d3.scaleBand
I am now translating the paths by i*(y.bandwidth()+0.1*y.bandwidth())+0.05*y.bandwidth()
The padding function allows you to set padding between the bands, and above and below, as seen below in the documentation.
My suggestion would be to add whatever padding you need to your y translation.

How do i get the graph to draw a line for constant 0 values using amcharts?

I'm showing network throughput and disk io's in a graph.
But when there is no activity. 0 get's reported.
The balloon shows me 0 but the line is not being drawn.
it looks like the grid is on top but if I turn the grid off the line still isn't there.
if I make line-thickness 2, I can see it but then the line changes thickness between 0 value and non 0 value. from 1px to 2 px.
i can't find anything in the documentation about this.
Any clue?
Unfortunately this is a limitation with the library as it doesn't draw lines outside of the plot area so the line will be clipped at the edges as you've noticed. Setting the lineThickness to a larger number like you already did along with setting the valueAxis' zeroGridAlpha property to zero will improve it slightly, but your best bet is setting a small negative minimum in your valueAxis so that the zero line is clearly visible. You can combine this with setting showFirstLabel to false to hide the first negative value in your axis.
Demo

Is there any way I can get precise metrics (line ascent, line descent, etc.) of the lines in a NSLayoutManager?

This is a followup to this.
After encountering issues with certain character compositions not working identically between Cocoa and Core Text, I decided to give Cocoa's text API a chance. Now, I need to be able to decompose a line vertically into each of its constituent parts:
whitespace due to NSParagraphStyle.paragraphSpacingBefore
whitespace due to NSParagraphStyle.lineHeightMultiple
typographic line ascent
typographic line descent
typographic line leading (line gap)
whitespace due to NSParagraphStyle.lineSpacing but not due to leading
whitespace due to NSParagraphStyle.paragraphSpacing
In Core Text, for the line ascent, descent, and leading, I could call CTLineGetBoundsWithOptions(0) and CTLineGetBoundsWithOptions(kCTLineBoundsExcludeTypographicLeading) (the origin of both of these rects is the baseline so I know where to chop) and then recreate Core Text's internal calculations for the CTParagraphStyle entries.
But I'm not sure what to do with NSLayoutManager, and trying to recreate the internal calculations isn't helping too much.
From what I can see, Cocoa's text system provides the following ways to get metric rectangles:
-[NSLayoutManager lineFragmentRectForGlyphAtIndex:effectiveRange:]
-[NSLayoutManager lineFragmentUsedRectForGlyphAtIndex:effectiveRange:]
-[NSLayoutManager boundingRectForGlyphRange:inTextContainer:]
However, these are not adequate enough to give me the data I need. For the first two, Apple has this to say:
In addition to the line fragment rectangle itself, the typesetter returns a rectangle called the used rectangle. This is the portion of the line fragment rectangle that actually contains glyphs or other marks to be drawn. By convention, both rectangles include the line fragment padding and the interline space calculated from the font’s line height metrics and the paragraph’s line spacing parameters. However, the paragraph spacing (before and after) and any space added around the text, such as that caused by center-spaced text, are included only in the line fragment rectangle and not in the used rectangle.
And the last seems to be completely unrelated to the first two :S
I did try to recreate Core Text's logic to determine what the line ascent and descent should be, assuming that the line ascent starts from the maximum font ascent of all the glyphs on the line, but that didn't quite work: instead of having the previous descent and the current ascent be the same line on a font with no leading like Palatino and no paragraph style, the two lines were some points apart :S
So is what I want possible? If not, I'll have to investigate ways to get Core Text to render and position combining accents the same way as Cocoa, or worse, manually lay out lines to at least avoid overlap (worse because I assume Apple knows what they are doing...)
This is for Mac OS X; I need to target 10.8 or newer. Thanks!

Geoserver SLD style - double dashed line

Is it possible to make SLD style for Geoserver maps to represent street that has 3 tracks (or more) with something like this
I know that it is possible to make single dashed line ------ so the street will apear to have 2 tracks, but I was unable to make double dashed or triple dashed line. I just need to represent each track on street.
I think it might be possible with using custom shape along with textsymbolizer and then making it appear as double dashed line, but I cannot use that because of all vendor options for displacement cause I will have street name, street direction etc. also with textsymbolizer.... I was wondering is it possbile with some line displacement or something similar?
Thx :)
You could try to use the offset function ( http://docs.geoserver.org/stable/en/user/filter/function_reference.html ). So you calculate a offset of e.g. +4 +2 -2 and -4 for your street. The +4 and -4 offset lines could be styled solid and the +2 and -2 offset lines could be styled dashed and in a different color. But you will still have a problem at the road links because the lines will be overlapping or there will be gaps.
Be aware that the geoserver needs to calculate an offset for 4 lines in realtime which could slow down performance. If the data is not changing you can use the GWC to serve tiles.

How to remove white margin around some Mathematica graphs

I'm trying to create a matrix plot with mathematica. Using ArrayPlot[] I get a very nice figure, apart from the fact that it's surrounded by a white margin. I've got to the root of the problem, in the sense of the following example.
http://img689.imageshack.us/img689/8427/badmargin.png
If I try to export the resulting graphic, it exports the margin also. I want my array content to fill a rectangle of a certain size so that it can be superimposed on another image, but the ArrayPlot function produces margins that interfere.
What do?
QuickEdit: ImageCrop will not work in my case, because a) I want my resulting image to be of a certain size, and b) without specifying how wide margins I want to remove the automatic version may mess with my graph (first row may well be white, for example).
Try PlotRangePadding->0
Apparently my reply was too short, so I'm typing more.
If you set the option Background->None the edges should be transparent. This would work if you were embedding it in another graphic.

Resources