Whenever I activate a VolumeSeries in my chart, the BottomAxis labels and ticks change to accomodate the series' Marks.
How do I disable that?
Problem on BottomAxis ticks and labels
-
- Newbie
- Posts: 11
- Joined: Fri Jun 06, 2008 12:00 am
- Location: Brazil
- Contact:
Re: Problem on BottomAxis ticks and labels
Hello PS Soluções,
I couldn't reproduce your problem using last version of TeeChartVCL 2010 and next code:
Could you say us if previous code works as you want? Moreover, Can you say us which version of TeeChartVCL are you using?
Thanks,
I couldn't reproduce your problem using last version of TeeChartVCL 2010 and next code:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Series1.Active:=False;
Series2.FillSampleValues(10);
Series2.Marks.visible:=True;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Series1.Active:=True;
Series2.Active:=False;
Series1.FillSampleValues();
Series1.Marks.Visible := True;
end;
Thanks,
Best Regards,
Sandra Pazos / 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: 11
- Joined: Fri Jun 06, 2008 12:00 am
- Location: Brazil
- Contact:
Re: Problem on BottomAxis ticks and labels
Hi,
I'm using TeeChart Pro ActiveX v8.0.0.8 .
Plase, try sample my code. When showing only FastLineSeries, ticks behave as usual. When VolumeSeries is also Active, the evenly spaced "ticks" on bottom axis disappear, showing only ticks for the "labels" of the volume series. I don't know if this is a BUG or a feature. If it is a feature, I can't find a way to disable it.
Here's a sample code in C#.
I'm using TeeChart Pro ActiveX v8.0.0.8 .
Plase, try sample my code. When showing only FastLineSeries, ticks behave as usual. When VolumeSeries is also Active, the evenly spaced "ticks" on bottom axis disappear, showing only ticks for the "labels" of the volume series. I don't know if this is a BUG or a feature. If it is a feature, I can't find a way to disable it.
Here's a sample code in C#.
Code: Select all
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using TeeChart;
namespace PS.Preditor.Forms
{
public class TestChart : Form
{
private ISeries series = null;
private AxTeeChart.AxTChart mChart;
private System.Windows.Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TestChart));
this.mChart = new AxTeeChart.AxTChart();
this.button1 = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.mChart)).BeginInit();
this.SuspendLayout();
//
// mChart
//
this.mChart.Dock = System.Windows.Forms.DockStyle.Fill;
this.mChart.Enabled = true;
this.mChart.Location = new System.Drawing.Point(0, 0);
this.mChart.Name = "mChart";
this.mChart.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("mChart.OcxState")));
this.mChart.Size = new System.Drawing.Size(447, 243);
this.mChart.TabIndex = 2;
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.button1.Location = new System.Drawing.Point(0, 243);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(447, 23);
this.button1.TabIndex = 3;
this.button1.Text = "Show/Hide";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// TestChart
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(447, 266);
this.Controls.Add(this.mChart);
this.Controls.Add(this.button1);
this.Name = "TestChart";
this.Text = "TestChart";
this.Load += new System.EventHandler(this.TestChart_Load);
((System.ComponentModel.ISupportInitialize)(this.mChart)).EndInit();
this.ResumeLayout(false);
}
#endregion
public TestChart()
{
InitializeComponent();
}
private void TestChart_Load(object sender, EventArgs e)
{
this.mChart.Zoom.Enable = false;
this.mChart.Legend.Visible = false;
this.mChart.Scroll.Enable = EChartScroll.pmBoth;
this.mChart.Zoom.Animated = true;
this.mChart.Zoom.AnimatedSteps = 2;
this.mChart.Panel.BorderStyle = EBorderStyle.bsSingle;
this.mChart.Panel.BevelInner = EPanelBevel.bvNone;
this.mChart.Panel.BevelOuter = EPanelBevel.bvNone;
this.mChart.Panel.Color = System.Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.White));
this.mChart.Panel.MarginTop = 2;
this.mChart.Panel.MarginBottom = 1;
this.mChart.Panel.MarginRight = 1;
this.mChart.Panel.MarginLeft = 2;
this.mChart.Legend.Visible = false;
this.mChart.Legend.Alignment = ELegendAlignment.laRight;
this.mChart.Legend.LegendStyle = ELegendStyle.lsSeries;
this.mChart.Legend.VertMargin = 2;
this.mChart.Legend.HorizMargin = 2;
this.mChart.Axis.Left.Labels.ValueFormat = "0.0####";
this.mChart.Axis.Left.TickOnLabelsOnly = true;
this.mChart.Axis.Bottom.Labels.ValueFormat = "0.0####";
this.mChart.Axis.Bottom.TickOnLabelsOnly = true;
this.mChart.Axis.Bottom.Labels.DateTimeFormat = "";
this.mChart.Axis.Left.StartPosition = 0.5;
this.mChart.Axis.Left.EndPosition = 99.5;
this.mChart.Axis.Right.StartPosition = 0.5;
this.mChart.Axis.Right.EndPosition = 99.5;
this.mChart.Axis.Top.StartPosition = 0.5;
this.mChart.Axis.Top.EndPosition = 99.5;
this.mChart.Axis.Bottom.StartPosition = 0.5;
this.mChart.Axis.Bottom.EndPosition = 99.5;
this.mChart.Aspect.View3D = false;
this.mChart.Walls.Visible = false;
// Add fastline series
int serieIndex = mChart.AddSeries(ESeriesClass.scFastLine);
ISeries series1 = mChart.get_aSeries(serieIndex);
series1.FillSampleValues(2048);
// Add volume series
int sindex = mChart.AddSeries(ESeriesClass.scVolume);
series = mChart.get_aSeries(sindex);
series.Active = false;
series.ColorEachPoint = true;
series.ShowInLegend = false;
series.VerticalAxis = EVerticalAxis.aLeftAxis;
series.Marks.Visible = true;
series.Marks.Multiline = false;
series.Marks.Shadow.Visible = false;
series.Marks.Arrow.Color = System.Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.Black));
uint red = System.Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(Color.Red));
series.AddXY(10, 10, "#1", red);
series.AddXY(20, 15, "#2", red);
series.AddXY(40, 9, "#3", red);
IVolumeSeries vseries = series.asVolume;
vseries.LinePen.Width = 3;
vseries.UseYOrigin = true;
vseries.YOrigin = 0;
}
private void button1_Click(object sender, EventArgs e)
{
series.Active = !series.Active;
}
}
}
Re: Problem on BottomAxis ticks and labels
Hello PS Soluções,
If you want values of both series appears on the axes Bottom you need change labels style. You can do it using labels property style TChart1.Axis.Bottom.Labels.Styleand change default style for talValue as do next code:
Could you say if previous code works as you want?
I hope will helps.
If you want values of both series appears on the axes Bottom you need change labels style. You can do it using labels property style TChart1.Axis.Bottom.Labels.Styleand change default style for talValue as do next code:
Code: Select all
Private Sub Form_Load()
InitializeChart
End Sub
Private Sub InitializeChart()
TChart1.AddSeries scFastLine
TChart1.AddSeries scVolume
TChart1.Aspect.View3D = False
TeeCommander1.Chart = TChart1
'Add Fastlin series
TChart1.Series(0).FillSampleValues (10)
TChart1.Series(0).Marks.Visible = True
TChart1.Series(0).Marks.Style = smsXValue
TChart1.Series(0).Color = vbBlue
'Add Volum Series values
Dim s As Long
With TChart1.Series(1)
s = .AddXY(1, 100, "#1", vbRed)
s = .AddXY(2, 500, "#2", vbRed)
s = .AddXY(3, 248, "#3", vbRed)
.ColorEachPoint = True
.ShowInLegend = False
.VerticalAxis = aLeftAxis
.Marks.Visible = True
.Marks.MultiLine = False
.Marks.Shadow.Visible = False
End With
With TChart1.Series(1).asVolume
.UseYOrigin = True
.YOrigin = 0
.LinePen.Width = 3
End With
TChart1.Axis.Bottom.Labels.Style = talValue
End Sub
I hope will helps.
Best Regards,
Sandra Pazos / 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: 11
- Joined: Fri Jun 06, 2008 12:00 am
- Location: Brazil
- Contact:
Re: Problem on BottomAxis ticks and labels
It works! Thanks for the help.