TeeChart NET for Blazor Legend checkboxs not working

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
dynamicrisk
Newbie
Newbie
Posts: 11
Joined: Thu Apr 06, 2023 12:00 am

TeeChart NET for Blazor Legend checkboxs not working

Post by dynamicrisk » Wed Aug 14, 2024 3:19 pm

Hi,

I am trying to add checkboxes to my chart legend using Legend.ActiveStyle = LegendActiveStyles.CheckBox and Legend.CheckBoxes = true. Neither seem to be working.

Here is the sample code I am using:

public Task<string> GetJSChart(int chartType, int width, int height)
{
Steema.TeeChart.TChart mChart = new TChart();

bool animate = false;

switch (chartType) {
case 0: Line line = new Line(mChart.Chart);
animate=true;
break;
case 1:
Points points = new Points(mChart.Chart);
Points facilities = new Points(mChart.Chart);
animate=true;
break;
case 2: Area area1 = new Area(mChart.Chart);
Area area2 = new Area(mChart.Chart);
animate = true;
break;
case 3: break;
case 5: Bubble bubble = new Bubble(mChart.Chart); animate = true; break;
case 6: Candle candle = new Candle(mChart.Chart); break;
case 7: Gantt gantt = new Gantt(mChart.Chart);
break;
case 31: Pie pie = new Pie(mChart.Chart); break;
case 32: Donut donut = new Donut(mChart.Chart); break;
case 33:
case 34: CircularGauge cGauge = new CircularGauge(mChart.Chart); break;
}

var series = mChart.Series[0];

var seriesFacility = mChart.Series[1];

mChart.Header.Text = "ILI Chart";

mChart.Axes.Left.Title.Text = "Clock";
mChart.Axes.Left.Inverted = true;
mChart.Axes.Bottom.Title.Text = "Odometer";
mChart.Legend.ActiveStyle = LegendActiveStyles.CheckBox;
mChart.Legend.CheckBoxes = true;

mChart.Legend.LegendStyle = LegendStyles.Series;

int counter = 0;
foreach (Series s in mChart.Series)
{
if (series.GetType() == typeof(Bubble))
{
((Bubble)(s)).Pointer.Gradient.Visible = true;
((Bubble)(s)).Pointer.Pen.Visible = false;
s.FillSampleValues(50);
}
else if ((series.GetType() == typeof(Gantt)))
s.FillSampleValues(9);
else
{
// scatter series
if(counter == 0)
{
s.FillSampleValues();
for (int i = 0; i < 101; i++)
{
Random rnd = new Random();

s.XValues.Value = rnd.NextDouble() * 1000;
s.YValues.Value = rnd.NextDouble() * 12;
}
}
// Facilities
if (counter == 1)
{
s.FillSampleValues(15);
for (int i = 0; i <= 14; i++)
{
Random rnd = new Random();

s.XValues.Value = rnd.NextDouble() * 1000;
s.YValues.Value = 0;
}
((Points)(s)).Pointer.Style = PointerStyles.DownTriangle;
((Points)(s)).Pointer.VertSize = 12;
((Points)(s)).Pointer.HorizSize = 12;
}
counter++;
}
}

// ToDo
ChartAggregate aggregate = ChartAggregate.Average;
//mChart.Chart.Series.Aggregate

if ((series.GetType() != typeof(Gantt)))
mChart.Axes.Left.SetMinMax(0, 12);

chartName = "dynoTeeChart";
mChart.Export.Image.JScript.ChartName = chartName;

MemoryStream ms = new MemoryStream();
mChart.Export.Image.JScript.Width = width;
mChart.Export.Image.JScript.Height = height;
mChart.Export.Image.JScript.DoFullPage = false; //inline, no page <html> header tags

if ((series.GetType() == typeof(Pie)) ||
(series.GetType() == typeof(Donut)))
{
series.Marks.Visible = true;
series.Marks.Arrow.Visible = false;
series.Marks.Arrow.Color = Color.White;
series.Marks.Transparent = true;
series.Marks.Pen.Transparency = 100;
series.Marks.Pen.Color = Color.White;
series.Marks.Font.Color = Color.White;

mChart.Export.Image.JScript.CustomCode = getCustomCodeOp2(mChart);
}
else
mChart.Export.Image.JScript.CustomCode = getCustomCode1(animate, mChart, series);

if ((series.GetType() == typeof(Gantt)))
{
((Gantt)series).Brush.Gradient.Visible = false;
((Gantt)series).NextTasks[0] = 6;
mChart.Axes.Left.Title.Text = "task";
}

if ((series.GetType() == typeof(CircularGauge)))
{
mChart.Axes.Left.Title.Text = "µHz";

var customCode = new List<string>();

if (chartType == 34)
{
customCode.Add("modGauge(" + chartName + ", " + chartName + ".series.items[0]" + ");");
customCode.Add("setTimeout(modVal, 500);");
}
else
{
((CircularGauge)(mChart[0])).Value = 0;
customCode.Add(chartName + ".series.items[0]" + ".format.shadow.visible=false;");
customCode.Add(chartName + ".series.items[0]" + ".back.visible=false;");
customCode.Add("growVal(" + chartName + ");");
customCode.Add("setTimeout(growVal, 500);");
}

mChart.Export.Image.JScript.CustomCode = customCode.ToArray();

}

title = mChart.Series[0].Description;

mChart.Export.Image.JScript.Save(ms);

ms.Position = 0;

StreamReader reader = new StreamReader(ms);
//setup our chart name, here 'dynoChartName'.
string result = "<script> var " + chartName + "; " + reader.ReadToEnd() + "</script>";

return Task.FromResult(result);
}

Thanks

Marc
Site Admin
Site Admin
Posts: 1258
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: TeeChart NET for Blazor Legend checkboxs not working

Post by Marc » Fri Aug 16, 2024 11:42 am

Hello,

The TeeChart Javascript library doesn't yet support Legend CheckBox. I've added it as a feature-request.

Click sensoitivity for the Legend could be added in different ways. We'll make up a code example.

Regards,
Marc Meumann
Steema Support

dynamicrisk
Newbie
Newbie
Posts: 11
Joined: Thu Apr 06, 2023 12:00 am

Re: TeeChart NET for Blazor Legend checkboxs not working

Post by dynamicrisk » Thu Aug 22, 2024 1:58 pm

Hello,

Just following up to see if there are any updates on this.

Thanks

Edu
Newbie
Newbie
Posts: 32
Joined: Tue Nov 28, 2023 12:00 am

Re: TeeChart NET for Blazor Legend checkboxs not working

Post by Edu » Fri Aug 23, 2024 10:13 am

Hello,

The team has been making progress, and we're getting close to finalizing a new update that includes this functionality. We expect it to be ready soon.

I'll share more details as soon as they're available.

Thank you for your patience.

Best regards,
Edu
Edu
Steema Support

Edu
Newbie
Newbie
Posts: 32
Joined: Tue Nov 28, 2023 12:00 am

Re: TeeChart NET for Blazor Legend checkboxs not working

Post by Edu » Mon Sep 02, 2024 10:13 am

Hi,
I’m pleased to inform you that your request has been successfully completed and is now ready for implementation. With the latest release (2024.8.30), you can begin using it immediately.

Code: Select all

tChart.Legend.ActiveStyle = LegendActiveStyles.CheckBox;
And this is how it looks like:
LegendCheckbox1.png
LegendCheckbox1.png (131.32 KiB) Viewed 4520 times
Best regards,
Edu
Edu
Steema Support

Post Reply