Chart data import in Delphi

TMS FNC Chart v2.0 is a major milestone and we are already collecting feedback and thinking about new features for the next version. We listed some of the top requested features in this blog post, but if you have other exciting ideas, please let us know in the comments. The blog post also gives an overview of what v2.0 brings alongside some very interesting chart related topics!

Data Import

This specific blog post however, focuses on a very important aspect of application development: data import. TMS FNC Chart is designed with one thing in mind: flexibility. The main goal in the FNC architecture has always been flexibility, and in TMS FNC Chart, this is no different. TMS FNC Chart is capable of importing JSON, CSV & custom data arrays. While designing these specific features, we aimed for loading data with a single line of code, but with the ability to customize the details. After running through installation process, you’ll find a demo which focuses on data import and demonstrates how to bring out the maximum potential of the chart. As a small code snippet, you’ll see how easy it is to add & append data.

procedure TForm1.LoadInitialData;
  loadOptions: TTMSFNCChartLoadOptions;
  loadOptions := TTMSFNCChartLoadOptions.Create;
    loadOptions.YRange := arEnabledZeroBased;
    TMSFNCBarChart1.LoadFromDataArray(loadOptions, 0, [123, 98, 54, 154, 128, 87, 103], nil, ['Apple', 'Watermelon', 'Pineapple', 'Pear', 'Banana', 'Lemon','Grapefruit', 'Peach']).LegendText := 'Sold';

The above code snippet loads the initial data.

procedure TForm1.AppendData;
  s: TTMSFNCChartSerie;
  s := TMSFNCBarChart1.AddSeriesFromDataArray([0.88, 1.32, 2.43, 0.76, 0.44, 1.03, 1.10]);
  s.YValues.Positions := [ypLeft];
  s.LegendText := 'Price';

Afterwards, we can append data and add new series without having to clear the ones that already exist.

TMS Software Delphi  Components

Code snippets are great to get started, but what’s even better is a video, explaining the capabilities in detail.


In the coming weeks, we’ll bring out more videos, so stay tuned! Anything you wish to see covered in a video or blog post? Please let us know.