TeeChart bottom axis labels are cut off in iOS - ios

I'm building an iOS app (unified) using Xamarin. I'm also using TeeCharts. I have a very simple bar chart whose bottom axis labels are rotated by 90 degrees (vertical labels). The bottom axis shows dates (10 days, starting from today). I've also set the date format to "MM/dd".
Here's my code:
private void CreateChartUI()
{
CGColor textColor = UIColor.Black.CGColor;
this.Chart.Aspect.View3D = false;
this.Chart.Header.Text = String.Empty;
this.Chart.Aspect.ZoomScrollStyle = Steema.TeeChart.Drawing.Aspect.ZoomScrollStyles.Manual;
this.Chart.Zoom.Active = false;
this.Chart.Zoom.Allow = false;
this.Chart.Panning.Allow = ScrollModes.None;
this.Chart.Legend.Visible = false;
this.Chart.Header.Text = "Test";
// Walls
this.Chart.Walls.Back.Pen.Visible = false;
this.Chart.Walls.Back.Gradient.Visible = false;
this.Chart.Walls.Back.Color = UIColor.Gray.CGColor;
// Left axis
this.Chart.Axes.Left.AxisPen.Visible = false;
this.Chart.Axes.Left.Grid.Visible = false;
this.Chart.Axes.Left.Ticks.Visible = false;
this.Chart.Axes.Left.MinorTicks.Visible = false;
this.Chart.Axes.Left.MinorGrid.Visible = false;
this.Chart.Axes.Left.Grid.Style = Steema.TeeChart.Drawing.DashStyle.Solid;
this.Chart.Axes.Left.Grid.Color = UIColor.White.CGColor;
this.Chart.Axes.Left.Grid.Width = 2;
this.Chart.Axes.Left.Labels.Font.Color = textColor;
this.Chart.Axes.Left.MaximumOffset = 30;
// Bottom axis
this.Chart.Axes.Bottom.AxisPen.Visible = false;
this.Chart.Axes.Bottom.Grid.Visible = false;
this.Chart.Axes.Bottom.Ticks.Visible = false;
this.Chart.Axes.Bottom.MinorTicks.Visible = false;
this.Chart.Axes.Bottom.MinorGrid.Visible = false;
this.Chart.Axes.Bottom.Grid.Visible = false;
this.Chart.Axes.Bottom.Labels.Angle = 90;
this.Chart.Axes.Bottom.Labels.Font.Color = textColor;
// series
Steema.TeeChart.Styles.Bar testSeries = new Steema.TeeChart.Styles.Bar() { VertAxis = Steema.TeeChart.Styles.VerticalAxis.Left };
testSeries.Marks.Visible = false;
testSeries.Color = UIColor.Blue.CGColor;
testSeries.XValues.DateTime = true;
testSeries.BarWidthPercent = 100 * (int) (float)UIKit.UIScreen.MainScreen.Scale;
testSeries.SideMargins = true;
this.Chart.Series.Add(testSeries);
}
The result is this:
As you can see, the labels of the bottom axis are cut off. I'm using the latest TeeChart version (4.15.1.19).
Any help would be appreciated.

yes, you're correct, it's a bug which has already been fixed. It will be included into the next maintenance release which will be availble at the Xamarin Store and also on our web site at the customers download page.
Thanks!
Josep

Related

compton config for transparency in i3's tabbed/stacked mode

Problem:
I am trying to:
make some applications transparent using compton on i3wm such that
in tabbed/ stacked mode in i3wm the underlying windows are hidden (or are not drawn).
=========================================
Example:
For example's sake, let us take the application to be zathura.
I tried the following in my compton.conf:
opacity-rule = [
"90:class_g = 'Zathura' && !_NET_WM_STATE#:32a",
"0:_NET_WM_STATE#:32a *= '_NET_WM_STATE_HIDDEN'"
]
This makes zathura transparent when it is unfocused. If zathura is focused then it will not be transparent. So zathura is hidden if it is beneath any other transparent window in tabbed/ stacked window.
Next I tried the following in compton.conf:
opacity-rule = [
"90:class_g = 'Zathura'",
"0:_NET_WM_STATE#:32a *= '_NET_WM_STATE_HIDDEN'"
]
This does make zathura transparent, but this draws zathura beneath other windows when in tabbed or stacked mode in i3wm.
I found this and tried the suggested solution. That is, I replaced "0:_NET_WM_STATE#:32a *= '_NET_WM_STATE_HIDDEN'" with
"0:_NET_WM_STATE#[0]:32a = '_NET_WM_STATE_HIDDEN'",
"0:_NET_WM_STATE#[1]:32a = '_NET_WM_STATE_HIDDEN'",
"0:_NET_WM_STATE#[2]:32a = '_NET_WM_STATE_HIDDEN'",
"0:_NET_WM_STATE#[3]:32a = '_NET_WM_STATE_HIDDEN'",
"0:_NET_WM_STATE#[4]:32a = '_NET_WM_STATE_HIDDEN'"
However this made no change. Please help.
=========================================
Config file:
My entire compton.conf is below. Remark: Some applications such as urxvt or emacs allow me to set transparency natively. Those applications behave well in tabbed/ stacked mode with the following config:
menu = { shadow = false; };
dropdown_menu = { shadow = false; };
popup_menu = { shadow = false; };
utility = { shadow = false; };
# Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-exclude = [
"class_g = 'i3-frame'",
"class_g = 'keynav'",
"name = 'Notification'",
"class_g ?= 'Notify-osd'",
"_GTK_FRAME_EXTENTS#:c"
];
opacity-rule = [
# "90:class_g = 'Zathura'",
"90:class_g = 'Zathura' && !_NET_WM_STATE#:32a",
# "0:_NET_WM_STATE#:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE#[0]:32a *= '_NET_WM_STATE_HIDDEN'"
,"0:_NET_WM_STATE#[1]:32a *= '_NET_WM_STATE_HIDDEN'"
,"0:_NET_WM_STATE#[2]:32a *= '_NET_WM_STATE_HIDDEN'"
,"0:_NET_WM_STATE#[3]:32a *= '_NET_WM_STATE_HIDDEN'"
,"0:_NET_WM_STATE#[4]:32a *= '_NET_WM_STATE_HIDDEN'"
];
# Fading
fading = true;
fade-delta = 5;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [ ];
# Other
backend = "xrender";
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
vsync = "none";
dbe = false;
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];
# GLX backend
glx-copy-from-front = false;
glx-swap-method = "undefined";
# Window type settings
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; };
};

Xamarin Android - Oxyplot, hide axis values

I am developing a xamarin android app and I am using oxyplot to display a graph. This is the code of oxyplot
OxyPlot.Axes.CategoryAxis xaxis = new OxyPlot.Axes.CategoryAxis();
xaxis.Position = AxisPosition.Bottom;
xaxis.TextColor = OxyColors.Transparent;
xaxis.IsPanEnabled = false;
xaxis.IsAxisVisible = false;
xaxis.MinorTickSize = 0;
xaxis.MajorGridlineStyle = LineStyle.None;
xaxis.MinorGridlineStyle = LineStyle.None;
xaxis.IsZoomEnabled = false;
xaxis.IsPanEnabled = false;
LinearAxis yaxis = new LinearAxis();
yaxis.Position = AxisPosition.Left;
yaxis.TextColor = OxyColors.Transparent;
yaxis.IsPanEnabled = false;
yaxis.IsAxisVisible = false;
yaxis.MinorTickSize = 0;
yaxis.MajorGridlineStyle = LineStyle.None;
yaxis.MinorGridlineStyle = LineStyle.None;
yaxis.IsZoomEnabled = false;
yaxis.IsPanEnabled = false;
OxyPlot.Series.ColumnSeries s1 = new OxyPlot.Series.ColumnSeries();
//s1.IsStacked = true;
s1.Items.Add(new ColumnItem(100));
s1.Items.Add(new ColumnItem(55));
var model = new PlotModel();
model.Background = OxyColors.White;
model.PlotAreaBorderColor = OxyColors.Transparent;
model.Series.Add(s1);
model.IsLegendVisible = false;
return model;
And this is the output in my phone
The problem is that I wanna hide everything except the two bars. Hide the lines and the values of the axis. Thank you very much.
As said in the documentation:
If no axes are defined, linear axes will be added to the bottom and left.
You have not set these two axes to your model, so it adds two default axes.
You could try to use the following codes to add axes:
//...
//Your other code
//....
var model = new PlotModel();
model.Background = OxyColors.White;
model.PlotAreaBorderColor = OxyColors.Transparent;
//Add axes
model.Axes.Add(xaxis);
model.Axes.Add(yaxis);
model.Series.Add(s1);
model.IsLegendVisible = false;

Ipad not showing canvas lines properly

I have created small script for vision testing. I posted part of it on https://jsfiddle.net/jaka_87/bpadyanh/
The theory behind it: Canvas is filled with pattern.In each pattern there are 3 lines drawn. Two black ones with the white one in the middle. The white line has 2*with of one black line. When width of this lines is so small that our eye cant distinguish between these three we see only gray background (even thou the lines are still there).
I tested it on few computers. On most of them it works well (thou i saw some strange patterns on some of the older ones - one column of vertical white lines then 2-3 dark column then white one....) I was assuming that it has do do with the display/graphic card or something similar. I tested it on some some mobile devices. It works fine on my Nexus 7 and Moto G, but not on my Transformer Prime pad (strange pattern like described before - for which again I blame the tablet).
It looks absolutely horrible (by far the worst from all tested) on my Ipad and my friends Iphone. I was expecting the best result there since they are known for very good screens but the results are horrible. When the lines are wide enough its OK but when they get narrower they are merged together to one either black or white line - not shown separately.
Is there any way to fix that so it would work on iOS ??
var povecava2 = "0.04226744186046511";
var izmerjeno =1;
var razmak =3.5;
var contrast = 1;
var canvas = document.getElementById('canvas1');
var ctx = canvas.getContext('2d');
// širina canvasa
ctx.canvas.width = window.innerWidth-23;
ctx.canvas.height = window.innerHeight-70;
var sirinaopto=Math.round(200*izmerjeno*povecava2*razmak);
if(sirinaopto & 1){sirinaopto=sirinaopto;}else{ sirinaopto=sirinaopto+1;} // če je širina optotipa soda ali liha
var enota4 =((0.19892970392*130*izmerjeno*povecava2)/4).toFixed(2); // 1 kotna minuta
var center= Math.round((ctx.canvas.width-(sirinaopto))/2);
// kolkrat gre v višino
var kolkratgre = Math.floor(ctx.canvas.height/(sirinaopto));
var visina2= sirinaopto*kolkratgre;
// kolkrat gre v širino
var kolkratgrehor = Math.ceil(ctx.canvas.width/sirinaopto); if(kolkratgrehor % 2 == 0) { var kolkratgrehor=kolkratgrehor-1; }
var zacetek = (ctx.canvas.width-(kolkratgrehor*sirinaopto))/2;
ctx.rect(0,0,ctx.canvas.width,ctx.canvas.height);
ctx.fillStyle="rgb(140,140,140)";
ctx.fill();
// 90 stopinj
var canvasPattern0 = document.createElement("canvas");
canvasPattern0.width = sirinaopto;
canvasPattern0.height = sirinaopto;
var contextPattern0 = canvasPattern0.getContext("2d");
contextPattern0.mozImageSmoothingEnabled = false;
contextPattern0.imageSmoothingEnabled = false;
contextPattern0.translate((canvasPattern0.width/2)-(enota4*2),(canvasPattern0.width/2)-(10*enota4));
contextPattern0.beginPath();
contextPattern0.globalAlpha = contrast;
contextPattern0.moveTo(enota4/2,0);
contextPattern0.lineTo(enota4/2,20*enota4);
contextPattern0.lineWidth=enota4;
contextPattern0.strokeStyle = 'black';
contextPattern0.stroke();
contextPattern0.closePath();
contextPattern0.beginPath();
contextPattern0.globalAlpha = contrast;
contextPattern0.moveTo(enota4*2,0);
contextPattern0.lineTo(enota4*2,20*enota4);
contextPattern0.lineWidth=enota4*2;
contextPattern0.strokeStyle = 'white';
contextPattern0.stroke();
contextPattern0.closePath();
contextPattern0.beginPath();
contextPattern0.globalAlpha = contrast;
contextPattern0.moveTo(enota4*3.5,0);
contextPattern0.lineTo(enota4*3.5,20*enota4);
contextPattern0.lineWidth=enota4;
contextPattern0.strokeStyle = 'black';
contextPattern0.stroke();
contextPattern0.closePath();
// 0 stopinj
var canvasPattern1 = document.createElement("canvas");
canvasPattern1.width = sirinaopto;canvasPattern1.height = sirinaopto;
var contextPattern1 = canvasPattern1.getContext("2d");
contextPattern1.translate(sirinaopto/2, sirinaopto/2);
contextPattern1.rotate(90*Math.PI/180);
contextPattern1.drawImage(canvasPattern0, sirinaopto*(-0.5), sirinaopto*(-0.5));
contextPattern1.save();
var imagesLoaded = [];
imagesLoaded.push(canvasPattern0);
imagesLoaded.push(canvasPattern1);
var randomPattern = function(imgWidth, imgHeight, areaWidth, areaHeight) {
// either set a defined width/height for our images, or use the first one's
imgWidth = sirinaopto;
imgHeight = sirinaopto;
// restrict the randmoness size by using an areaWidth/Height
areaWidth = ctx.canvas.width;
areaHeight = visina2;
// create a buffer canvas
var patternCanvas = canvas.cloneNode(true);
var patternCtx = patternCanvas.getContext('2d');
patternCanvas.width = areaWidth;
patternCanvas.height = areaHeight;
// var xloops = Math.ceil(areaWidth / imgWidth);
var xloops = Math.ceil(areaWidth / imgWidth); if(xloops % 2 == 0) { var xloops=xloops-1; }
var yloops = Math.ceil(areaHeight / imgHeight);
//alert(xloops);
for (var xpos = 0; xpos < xloops; xpos++) {
for (var ypos = 0; ypos < yloops; ypos++) {
var img = imagesLoaded[Math.floor(Math.random() * imagesLoaded.length)];
patternCtx.drawImage(img, (xpos * imgWidth)+zacetek, (ypos * imgHeight), imgWidth, imgHeight);
}
}
// create a pattern from this randomly created image
return patternCtx.createPattern(patternCanvas, 'repeat');
}
var draw = function() {
//create the random pattern (should be moved out of the draw)
var patt = randomPattern(sirinaopto,sirinaopto);
ctx.fillStyle = patt;
ctx.fillRect(0,0,ctx.canvas.width, visina2)
};
draw();

Swarming in AS2

Hi I keep getting the error: expecting identifier before greater than.
on line 13.
Any help would be nice please and Thank you.
fly = function () {
this.animate = function() {
// Capture mouse positions and distance from mouse
this.targetX = _root._xmouse;
this.targetY = _root._ymouse;
this.distX = this.targetX-this.meX+this.flockX;
this.distY = this.targetY-this.meY+this.flockY;
//
if ((this.targetX == this.oldTargetX) && Math.random()>0.9) {
// add small scale random darting if mouse is still
this.flockX = (Math.random()*100)-50;
this.flockY = (Math.random()*100)-50;
} else if ((this.targetX<>this.oldTargetX) && Math.random()>0.8) {
// add large scale random darting if mouse is moving
this.flockX = (Math.random()*400)-200;
this.flockY = (Math.random()*400)-200;
}
// Apply inertia equation
this.meX = Math.round(this.meX+(this.distX)/20);
this.meY = Math.round(this.meY+(this.distY)/20);
// perform animation
this._x = this.meX;
this._y = this.meY;
// remember the current mouse pos so we can tell if
// it has moved next time around
this.oldTargetX = this.targetX;
};
this.initialize = function() {
this.targetX = 0;
this.targetY = 0;
this.distX = 0;
this.distY = 0;
this.meX = this._x;
this.meY = this._y;
this.oldTargetX = 0;
this.flockX = (Math.random()*200)-100;
this.flockY = (Math.random()*200)-100;
};
// set up onEnterFrame script to animate _parent...
this.initialize();
this.onEnterFrame = this.animate;
};
//
//
var i:Number = 0;
var bugClip:MovieClip;
for (i=0; i<30; i++) {
bugClip = this.attachMovie("bug", "bug"+i, i);
fly.apply(bugClip);
}
I don't know about Actionscript, but by looking at your code I would recomend doing like this:
randomValue = Math.random()
if ((this.targetX == this.oldTargetX) && randomValue>0.9) {
The <> operator for not equals has been deprecated since Flash Player 5 Doc reference here
You should use != for the same functionality.
Although i tested this on Flash Player 10.2 and it will still compile and run with no errors. I guess you are compiling to a later version.

Microsoft charts: transparency

I want a chart with transparent background, and therefore PNG seems a good choice. But when I set transparent background, the quality of the axis labels falls dramatically. How do I fix this? See the following code. As it stands, the chart has a transparent background, as I want, but the text quality is atrocious. If I comment out the two "Color.Transparent" settings, then the text quality is nice, but the background is not transparent.
How do I get transparency and nice text?
public static void Main(string[] args)
{
Chart c = new Chart();
c.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
Series s = new Series("Series1");
c.Series.Clear();
c.Series.Add(s);
s.ChartType = SeriesChartType.Line;
s.Color = Color.Black;
ChartArea chartArea = new ChartArea("ChartArea1");
c.ChartAreas.Clear();
c.ChartAreas.Add(chartArea);
chartArea.BackColor = Color.FromArgb(255, 255, 255);
chartArea.BackSecondaryColor = Color.FromArgb(220, 220, 220);
chartArea.BackGradientStyle = GradientStyle.TopBottom;
chartArea.AxisX.LineColor = Color.Gray;
chartArea.AxisX.LineWidth = 2;
chartArea.AxisX.LineDashStyle = ChartDashStyle.Solid;
chartArea.AxisY.LineColor = Color.Gray;
chartArea.AxisY.LineWidth = 2;
chartArea.AxisY.LineDashStyle = ChartDashStyle.Solid;
chartArea.AxisX.MajorGrid.LineColor = Color.LightGray;
chartArea.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dash;
chartArea.AxisY.MajorGrid.LineColor = Color.LightGray;
chartArea.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash;
c.BackColor = Color.Transparent;
chartArea.BackColor = Color.Transparent;
double[] x = new double[] { 1999, 2005 };
double[] y = new double[] { 3210, 13456 };
Axis ay = chartArea.AxisY;
ay.Maximum = 13456;
ay.Minimum = 3210;
Axis ax = chartArea.AxisX;
ax.Maximum = 2005;
ax.Minimum = 1999;
for (int i = 0; i < x.Length; i++)
{
double xvalue = x[i];
double yvalue = y[i];
s.Points.AddXY(xvalue, yvalue);
}
// Save chart-image to disk:
c.SaveImage("chartimage.png", ChartImageFormat.Png);
}
Set chart's AntiAliasing to AntiAliasingStyles.Graphics to disable the antialiasing on text.
Taken from this thread.
Maybe this help you
in your .aspx file where your chart code is, look for the asp:ChartArea tag. then add BackColor = "Transparent".
<asp:ChartArea Name="ChartArea1" BackColor="Transparent"
</asp:ChartArea>
Hope this help.
chart.TextAntiAliasingQuality = TextAntiAliasingQuality.SystemDefault;
I read this from here: http://forums.asp.net/p/1656335/4315304.aspx?Re%20Chart%20transparency%20and%20text%20quality

Resources