Page 1 of 1

X axis label can't be shown

Posted: Sun Feb 19, 2023 7:48 am
by 15695043
Dear Suppoter,

I am in the process of upgrade Teechart from 4.1.2015 to 4.2002 version. But I got a problem to show the labels of x-axis for bar chart. I am using AxisLabelStyle.PointValue for axis label. It only shows one label on the x axis. All other labels are missing, it used to work fine on the old version of TeeChart. I paste my code as below. Please let me know how to solve it. Thank you.

public partial class Form1 : Form
{
private Steema.TeeChart.TChart chart;
public Form1()
{
InitializeComponent();

chart = new Steema.TeeChart.TChart();
chart.Aspect.View3D = false;
chart.BackColor = System.Drawing.Color.White;
chart.Legend.Brush.Gradient.StartColor = System.Drawing.SystemColors.Control;
chart.Location = new System.Drawing.Point(0, 0);

chart.AutoRepaint = false;
chart.Panel.Color = SystemColors.Window;
chart.Panel.Brush.Color = System.Drawing.Color.White;
chart.Panel.Brush.ForegroundColor = System.Drawing.Color.White;
chart.Panel.Brush.Gradient.EndColor = System.Drawing.Color.Empty;
chart.Panel.Brush.Gradient.MiddleColor = System.Drawing.Color.Empty;
chart.Panel.Brush.Gradient.StartColor = System.Drawing.Color.Empty;
chart.Panel.Brush.Gradient.UseMiddle = false;
chart.Panel.Brush.Gradient.Visible = false;
chart.Size = new System.Drawing.Size(568, 421);
chart.Walls.Back.Brush.Color = System.Drawing.Color.White;
chart.Walls.Back.Brush.Gradient.StartColor = System.Drawing.Color.White;
chart.Walls.View3D = false;

chart.Zoom.History = false;
chart.Zoom.Animated = false;

chart.Aspect.View3D = false;
chart.Aspect.Width3D = 0;
chart.Aspect.Height3D = 0;

chart.Legend.LegendStyle = LegendStyles.Series;
chart.Legend.Shadow.Visible = false;
chart.Legend.Inverted = true;
chart.Legend.ClipText = false;
chart.Legend.Pen.Color = Color.Transparent;
chart.Legend.Symbol.Width = 20;
chart.Legend.Symbol.WidthUnits = LegendSymbolSize.Pixels;
chart.Legend.Font.Size = 8;

chart.Axes.Bottom.FixedLabelSize = false;
chart.Axes.Left.FixedLabelSize = false;
chart.Axes.Right.FixedLabelSize = false;
chart.Axes.Bottom.Title.Visible = false;
chart.Axes.Left.Title.Visible = false;
chart.Axes.Right.Title.Visible = false;

chart.Axes.Bottom.Minimum = double.MinValue;
chart.Axes.Bottom.Maximum = double.MaxValue;

chart.Axes.Left.Minimum = double.MinValue;
chart.Axes.Left.Maximum = double.MaxValue;

chart.Axes.Right.Minimum = double.MinValue;
chart.Axes.Right.Maximum = double.MaxValue;

// default value DashCap.Flat results "invisible" lines of any dotted styles (DashStyle.Dot, DashStyle.DashDot), case of Direct2D
// SmoothingMode.HighSpeed of Direct2D doesn't show dots of line of 1pt
chart.Axes.Bottom.Grid.DashCap = DashCap.Round;
chart.Axes.Bottom.Grid.DrawEvery = 1;
chart.Axes.Left.Grid.DashCap = DashCap.Round;
chart.Axes.Left.Grid.DrawEvery = 1;
chart.Axes.Right.Grid.DashCap = DashCap.Round;

//-----------------------------------------------------
chart.Axes.Left.AxisPen.Visible = true;
chart.Axes.Left.Ticks.Visible = true;
chart.Axes.Left.MinorTicks.Visible = true;

chart.Axes.Bottom.AxisPen.Visible = true;
chart.Axes.Bottom.Ticks.Visible = true;
chart.Axes.Bottom.MinorTicks.Visible = true;

chart.Axes.Top.Automatic = true;
chart.Axes.Top.Visible = true;
chart.Axes.Top.AxisPen.Visible = true;
chart.Axes.Top.Labels.Visible = false;

chart.Axes.Right.AxisPen.Visible = true;
chart.Axes.Right.Ticks.Visible = true;
chart.Axes.Right.MinorTicks.Visible = true;
//-----------------------------------------------------

chart.Panel.Bevel.Width = 0;
chart.Panel.Bevel.Outer = BevelStyles.None;
chart.Panel.Bevel.Inner = BevelStyles.None;
chart.Panel.MarginUnits = PanelMarginUnits.Pixels;
chart.Panel.Bevel.Inner = BevelStyles.None;
chart.Panel.Bevel.Outer = BevelStyles.None;

chart.AutoRepaint = true;
chart.Dock = System.Windows.Forms.DockStyle.Fill;
chart.Axes.Bottom.Labels.Style = AxisLabelStyle.PointValue;
this.Controls.Add(chart);
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
var xValues = new DateTime[4];
for (int i = 0; i < 4; i++)
{
var dt = DateTime.Now.AddMonths(i);
// var dt = DateTime.Now.AddDays(i); Add days works well
xValues = dt;
}
var yValues = new double[4] { 50, 100, 200, 241 };
plotSeries(xValues, yValues);
}

private void plotSeries(DateTime[] xValues, double[] yValues)
{
var bar = new Bar();
chart.Series.Add(bar);
bar.Add(xValues, yValues);
bar.Brush.Visible = true;
bar.BarStyle = BarStyles.Rectangle;bar.Pen.Width = 0;
bar.Pen.Color = Color.Transparent;
bar.XValues.DateTime = true;
}
}

Re: X axis label can't be shown

Posted: Mon Feb 20, 2023 2:52 pm
by Christopher
Hello
DHIWATER wrote:
Sun Feb 19, 2023 7:48 am
All other labels are missing, it used to work fine on the old version of TeeChart. I paste my code as below. Please let me know how to solve it. Thank you.
Thank you for reporting this problem to us. We've been able to reproduce it here and have added it to our issue tracker with id=2590—this means that a fix to it will become available in our next NuGet release, which we hope to make public tomorrow.

Re: X axis label can't be shown

Posted: Tue Feb 21, 2023 9:49 am
by 15695043
Hi,
It's really nice that you can fix it. I am looking forward to this fix. Please let me know if it can be download from NuGet. Thank you.

Re: X axis label can't be shown

Posted: Tue Feb 21, 2023 3:43 pm
by Christopher
Hello,
DHIWATER wrote:
Tue Feb 21, 2023 9:49 am
Hi,
It's really nice that you can fix it. I am looking forward to this fix. Please let me know if it can be download from NuGet. Thank you.
Just to let you know that a new version of TeeChart is available on NuGet here:
https://www.nuget.org/packages/Steema.T ... .2023.2.21

Re: X axis label can't be shown

Posted: Wed Feb 22, 2023 12:58 am
by 15695043
Hi,

I have downloaded the new version for NuGet. It works perfect now. Thank you.