Hi,
We are trying to upgrade our very old teechart to the latest and were having some problem. One problem I'm having difficulty is setting the spacing of the vertical grid lines. Our current version doesnt have themes, now with the new version we are using TeeCharts theme.
Figure 1: Using the TeeChart theme gives me this screen. A uneven spacing of vertical grid lines. Note that I had to set the ChartAxis.Grid.DrawEvery = 1; in ThemeProperties.ChangeAxis(Axis ChartAxis) for bottom axis because for some reason it is set to 2 and what it does is skip 1 line which is not what we want.
Figure 2: It seems that commenting this code ThemeProperties.Instance.AxisLabelsFontSize = 8; from TeeChartThemes.SetDefaultValues() fixes the problem but the spacing is too wide compared to what we currently have.
What I need is to
1: Make date font smaller
2: Make the spacing between each v line and date tighter so I can show more dates
Figure 3: Is what our current app looks like with the old version of TeeChart.
Grid Spacing problem
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Grid Spacing problem
Hello,
gives me the following:
do you obtain the same at your end?
the following code, using the latest publicly available version of TeeChart.dll:sharewealth wrote: What I need is to
1: Make date font smaller
2: Make the spacing between each v line and date tighter so I can show more dates
Code: Select all
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
CreateChart();
InitializeChart();
}
TChart tChart1;
private void CreateChart()
{
tChart1 = new TChart();
tChart1.Dock = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(tChart1);
}
private void InitializeChart()
{
Candle series = new Candle(tChart1.Chart);
tChart1.Legend.Visible = false;
series.FillSampleValues(100);
series.UpCloseColor = Color.Green;
series.Style = CandleStyles.CandleBar;
tChart1.Axes.Bottom.Grid.Visible = true;
tChart1.Axes.Bottom.Labels.Font.Size = 3;
tChart1.Header.Text = Utils.Version;
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Export.Image.PNG.Save(@"D:\FTP\" + "TChart" + DateTime.UtcNow.Ticks.ToString() + ".png");
}
}
do you obtain the same at your end?
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 2
- Joined: Tue Jun 28, 2016 12:00 am
Re: Grid Spacing problem
After a digging through the code, I noticed that there is a logic that skips a line when the label is too wide which I think is there to avoid overlapping dates. I found it in Axes.AxisLabelsSeries(Rectangle rect)
where tmpDraw will be false if it thinks the date will overlap. I fixed this to always true and I got the result that I needed except that its a bit cramped..
This is the code where I force tmpDraw = true
And this is what I got Next question is, how to I set the width of the grid to make it a few pixels wider so the date text wont be too close to each other?
where tmpDraw will be false if it thinks the date will overlap. I fixed this to always true and I got the result that I needed except that its a bit cramped..
This is the code where I force tmpDraw = true
And this is what I got Next question is, how to I set the width of the grid to make it a few pixels wider so the date text wont be too close to each other?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Grid Spacing problem
It would be useful, if only to ascertain we are both running a binary which gives us the same result, if you could run the following code and post a screencap of the result you obtain:sharewealth wrote: Next question is, how to I set the width of the grid to make it a few pixels wider so the date text wont be too close to each other?
Code: Select all
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
CreateChart();
InitializeChart();
}
TChart tChart1;
private void CreateChart()
{
tChart1 = new TChart();
tChart1.Dock = DockStyle.Fill;
splitContainer1.Panel2.Controls.Add(tChart1);
}
private void InitializeChart()
{
Candle series = new Candle(tChart1.Chart);
tChart1.Legend.Visible = false;
series.FillSampleValues(100);
series.UpCloseColor = Color.Green;
series.Style = CandleStyles.CandleBar;
tChart1.Axes.Bottom.Grid.Visible = true;
tChart1.Axes.Bottom.Labels.Font.Size = 3;
tChart1.Header.Text = Utils.Version;
}
private void button1_Click(object sender, EventArgs e)
{
tChart1.Export.Image.PNG.Save(@"D:\FTP\" + "TChart" + DateTime.UtcNow.Ticks.ToString() + ".png");
}
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |