Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-08

Specifying Y axis

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Mace

Hi,
I have a line graph that only needs to display 0's and 1's however, when the first 0 is plotted, the Y axis is set-up as the lowest mark being -1, then goes up through 0 to then be +1.
How can I set the graph up to say that the lowest mark would be 0 and the highest would be 1?

Many thanks

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150815/68065505/attachment.html>

Reply by email

Werner Pamler
to Richard Mace
Chart1.Extent.YMax := 1;
Chart1.Extent.YMin := 0;
Chart1.Extent.UseYMax := true;
Chart1.Extent.UseYMin := true;

Call this before or after adding data to the series, or set it in the object inspector.

Richard Mace wrote 17 lines
Hi, I have a line graph that only needs to display 0's and 1's however, when the first 0 is plotted, the Y axis is set-up as the lowest mark being -1, then goes up through 0 to then be +1. How can I set the graph up to say that the lowest mark would be 0 and the highest would be 1? Many thanks Richard -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150815/d6712a31/attachment.html>

Reply by email

Richard Mace
to Werner Pamler
Werner Pamler wrote 8 lines
Chart1.Extent.YMax := 1; Chart1.Extent.YMin := 0; Chart1.Extent.UseYMax := true; Chart1.Extent.UseYMin := true; Call this before or after adding data to the series, or set it in the object inspector.

?Thanks Werner, That works great.
I've now got a the 0 as Min and the 1 as Max, however, it's also showing a 0.5 in the middle.
Any idea how I can remove that?

Also, is it possible to actually replace the 0 and 1 for words such as "true" and "false"?

Thanks

Richard?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150816/f8c1ebe0/attachment.html>

Reply by email

Werner Pamler
to Richard Mace

There are (at least) two solutions:

#1:
Select Chart.LeftAxis. Go to "Intervals", set "Count" to 2, and modify "Options" such that only "aipUseCount" and "aipUseNiceSteps" are active. Write an event handler for "OnMarkToText" of the LeftAxis: "if AMark = 0 then AMarkText := 'FALSE' else if AMark = 1 then AMarkText := 'TRUE';"

#2:
Add a ListChartSource to the form, Double-click on its property "DataPoints". In line 1 of the "DataPoint Editor" set Y=0, Text ='FALSE' (the other fields can be empty)
Cursor cown to add a new line: in line 2 enter Y = 1, Text = 'TRUE' Link the ListChartSource to the property "Source" of the Chart.LeftAxis.Marks.
Set the "Style" of the Chart.LeftAxis.Marks to "smsLabel".

Richard Mace wrote 31 lines
On 15 August 2015 at 10:38, Werner Pamler < <mailto:>>wrote: Chart1.Extent.YMax := 1; Chart1.Extent.YMin := 0; Chart1.Extent.UseYMax := true; Chart1.Extent.UseYMin := true; Call this before or after adding data to the series, or set it in the object inspector. ?Thanks Werner, That works great. I've now got a the 0 as Min and the 1 as Max, however, it's also showing a 0.5 in the middle. Any idea how I can remove that? Also, is it possible to actually replace the 0 and 1 for words such as "true" and "false"? Thanks Richard? -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150817/69d1c833/attachment.html>

Reply by email