Dashboard: Fill chart with static data (without external data source)

Stimulsoft Reports.NET discussion
Post Reply
Steff23
Posts: 19
Joined: Tue Apr 23, 2024 6:55 am

Dashboard: Fill chart with static data (without external data source)

Post by Steff23 »

Hello,

I am working with Stimulsoft Dashboards and I would like to fill a chart with data without using any external data source (SQL, CSV, Excel, etc.).
Since Business Objects are not supported in Dashboards, I am looking for a way to use an internal/static data source directly inside the report.

My questions:
1. Is there a way to create an internal data source in the Designer and enter values that can also be inserted via Copy & Paste (instead of typing each cell one by one)?
2. If not, how can I create a DataTable or something similar in code and register it as a data source for the Dashboard, so that I can select it in the chart?
3. Do I always need to call report.Dictionary.Synchronize() after report.RegData(...) to make the fields visible in the Dashboard?

Goal:
I just want to display a chart with static values (e.g. Months + Sales) – completely without any external data connection, only with internal data defined in the report or in code.

Thanks in advance for any tips or example code!

Best regards,
Steffen
Lech Kulikowski
Posts: 7511
Joined: Tue Mar 20, 2018 5:34 am

Re: Dashboard: Fill chart with static data (without external data source)

Post by Lech Kulikowski »

Hello,

> I just want to display a chart with static values (e.g. Months + Sales) – completely without any external data connection, only with internal data defined in the report or in code.

In this case, you can enter data manually.

Thank you.
Attachments
Screenshot 2025-10-15 223809.png
Screenshot 2025-10-15 223809.png (38.61 KiB) Viewed 2189 times
Steff23
Posts: 19
Joined: Tue Apr 23, 2024 6:55 am

Re: Dashboard: Fill chart with static data (without external data source)

Post by Steff23 »

Thanks!

Manual entry works for very small datasets, but it is cell-by-cell and does not support block paste (Copy & Paste).

My goal is to work completely without any database or other external data source, but still be able to process larger amounts of data in a chart in the Dashboard.

Is there any built-in way in Dashboards to insert or paste a whole block of data directly into a manual data source, so that larger datasets can be handled without relying on external files or databases?

I Use this in a Report:

Code: Select all

// CSV aus Variable "InputCsv" lesen
string csv = "";
var v = this.Dictionary.Variables["InputCsv"];
if (v != null) { csv = v.ValueObject as string; if (csv == null) csv = v.Value; }
csv = (csv ?? "").Replace("\r", "");
string[] lines = csv.Split('\n');
if (lines.Length < 2) { this.RegBusinessObject("Energie", new object[0]); return; }

// Header -> Indizes für Datum, MK, TP
int iD = -1, iMK = -1, iTP = -1;
string[] head = lines[0].Split(';');
for (int i = 0; i < head.Length; i++) {
string n = head[i].Trim().Trim('"');
    if (n == "Datum") iD = i; else if (n == "MK") iMK = i; else if (n == "TP") iTP = i;
}
if (iD < 0 || iMK < 0 || iTP < 0) { this.RegBusinessObject("Energie", new object[0]); return; }

// Summieren pro Datum
var de = new System.Globalization.CultureInfo("de-DE");
var map = new System.Collections.Generic.Dictionary<System.DateTime, decimal[]>(); // [0]=MK, [1]=TP

for (int r = 1; r < lines.Length; r++) {
string line = lines[r];
    if (string.IsNullOrWhiteSpace(line)) continue;
string[] c = line.Split(';');
int need = iD; if (iMK > need) need = iMK; if (iTP > need) need = iTP;
    if (c.Length <= need) continue;

    // Datum
System.DateTime d;
    if (!System.DateTime.TryParse(c[iD].Trim().Trim('"'), de, System.Globalization.DateTimeStyles.None, out d))
        continue;

    // MK
decimal mk = 0m;
string sMK = c[iMK].Trim().Trim('"');
bool ok = decimal.TryParse(sMK, System.Globalization.NumberStyles.Number, de, out mk);
    if (!ok) ok = decimal.TryParse(sMK, System.Globalization.NumberStyles.Number,
                                   System.Globalization.CultureInfo.InvariantCulture, out mk);

    // TP
decimal tp = 0m;
string sTP = c[iTP].Trim().Trim('"');
    ok = decimal.TryParse(sTP, System.Globalization.NumberStyles.Number, de, out tp);
    if (!ok) decimal.TryParse(sTP, System.Globalization.NumberStyles.Number,
                              System.Globalization.CultureInfo.InvariantCulture, out tp);

decimal[] arr;
if (!map.TryGetValue(d, out arr)) { arr = new decimal[2]; map[d] = arr; }
    arr[0] += mk;  // MK
    arr[1] += tp;  // TP
}

// In BO-Form bringen
object[] agg = new object[map.Count];
int j = 0;
foreach (System.Collections.Generic.KeyValuePair<System.DateTime, decimal[]> kv in map)
    agg[j++] = new { Datum = kv.Key, MK = kv.Value[0], TP = kv.Value[1] };

// Registrieren (BI-Designer). In Plano ggf. bo.BusinessObject = agg; verwenden.
this.RegBusinessObject("Energie", agg);
That only works in a report. I need it in a dashboard as well.
Attachments
2025-10-16 12 08 58_24390234_001.png
2025-10-16 12 08 58_24390234_001.png (80.5 KiB) Viewed 2145 times
2025-10-16 12 08 04_24390234_001.png
2025-10-16 12 08 04_24390234_001.png (86.83 KiB) Viewed 2145 times
Lech Kulikowski
Posts: 7511
Joined: Tue Mar 20, 2018 5:34 am

Re: Dashboard: Fill chart with static data (without external data source)

Post by Lech Kulikowski »

Hello,

> Is there any built-in way in Dashboards to insert or paste a whole block of data directly into a manual data source, so that larger datasets can be handled without relying on external files or databases?

Unfortunately, no.

Thank you.
Steff23
Posts: 19
Joined: Tue Apr 23, 2024 6:55 am

Re: Dashboard: Fill chart with static data (without external data source)

Post by Steff23 »

ok Thank you
Lech Kulikowski
Posts: 7511
Joined: Tue Mar 20, 2018 5:34 am

Re: Dashboard: Fill chart with static data (without external data source)

Post by Lech Kulikowski »

Hello,

You are welcome.
Post Reply